# Use unexpanded macro in package options

When I try to put in my package options with not yet defined macro (even if I use noexpand), the document fails to compile (even if I don't use the macro!). Any idea if it's fundamental or not? (I tried with kvoptions, but also with the regular system) Ideally I'd like to avoid \noexpand but for now any solution is interesting!

MWE:

test.tex:

\documentclass{article}
\usepackage[conf={I would like to use not (yet) defined macro here}]{teststy}
% Uncommenting the following line produces errors:
% \usepackage[conf={The value is: \noexpand\number\noexpand\value{counterAllProofEnd}}]{teststy}

\begin{document}
\section{Options}
\show\pratendOptconf
\newcounter{counterAllProofEnd}
\pratendOptconf %% Should display "The value is: 0"

\stepcounter{counterAllProofEnd}
\pratendOptconf %% Should display 1 "The value is: 1"

\end{document}


teststy.sty:

\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{teststy}[2019/05/06 A test]

\RequirePackage{kvoptions}

%% https://tex.stackexchange.com/questions/109747/put-all-package-options-into-one-command
%% Forward the options list to the command \pratendOptdefconf
%% in order to use:
%% \usepackage[conf={normal}]{proofAtTheEnd}
\SetupKeyvalOptions{
family=pratendOpt,
prefix=pratendOpt,
}
\DeclareStringOption{conf}
\DeclareLocalOptions{conf}% \pratendOptdefconf contains the proof
\ProcessKeyvalOptions*

% \DeclareOption*{\PackageWarning{proofAtTheEnd}{Unknown}}
% \ProcessOptions\relax

\endinput


Basically that means that the code passes through \edef and has white space removed.
That means that it is only really safe to have "classic" valueless options to a package [dvips], [fleqn] etc. In some cases you can make key=value options work but only if they are safe in an edef.
This is why for example hyperref allows kvoptions in the package option list but provides (and recommends) specifying the options separately via \hypersetup{...} which is only parsed by the keyvalue parser and so does not pre-expand the argument.