Any way to make a procedure param use another procedure param as fallback?

I can see how the following does not work because, presumably, the a has not been “processed” when b calls/fallsback on it:

\procedure test(a:"foo", b:"<<a>>") <<b>>

<<test>>  desired outcome: foo

…but I am a bit confused why the following does not work. I had expected a to have been “processed” by the time that b falls back on it:

\procedure outer(a:"foo")
\procedure inner(b:<<a>>)
<<b>>
\end inner
\end outer

<<outer>> expected outcome: foo

Do I misunderstand procedure nesting? Anything else wrong, or is this just how the earth spins?

My actual use case is a procedure with several optional parameters and I’m trying to avoid to, inside the procedure, having to test which parameters the user has provided values for.

Thanks :slight_smile:

1 Like

Hi @twMat the \procedure pragma only supports literal strings as the default values for parameters. You can use the underlying <$parameters> widget instead which does support dynamically computed default values.

Some helpful examples of parameter widget usage by Mohammad:

2 Likes

Hi @twMat In order to try Jeremy’s and Saq’s suggestions, don’t forget to explicitly call inner, likeso:

\procedure outer(a:"foo")
\procedure inner()
<$parameters b=<<a>> >
<<b>>
\end inner
<<inner>>
\end outer

<<outer>> expected outcome: foo
1 Like

Good point. It is easy to assume that the inner procedures are being automatically called as one calls for the container.