Thomas Morley <[email protected]> writes:

> c)
> The functions above are using two optional arguments.
> And I'm able to omit both optional arguments or the second.
> But I can't omit only the first.
> Why?

That's the design of optional function arguments.  If one gets skipped,
the rest following right behind are skipped as well.  Why?

a) if you'd continue to try matching, it would get increasingly harder
to find an argument that did not match _any_ of the following optional
arguments rather than just one, so the number of "weird" situations
would multiply,

b) \default is used for skipping _all_ remaining arguments in cases like
\key \default and it would be quite awkward to find semantics where
\default skipped all arguments, but an argument non-match skipped only
one.

c) if you have multiple optional arguments of the same type, it is not
possible to only match the second in a row rather than the first.  The
same situation with an optional and a mandatory argument of the same
kind can be resolved by using \default to skip the optional argument.

I am pretty sure that "Extending LilyPond" describes this, though
probably without giving the rationale for it.

-- 
David Kastrup

_______________________________________________
lilypond-user mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/lilypond-user

Reply via email to