lilypond-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Optional args in event-function not working with 2.17.6 ?


From: David Kastrup
Subject: Re: Optional args in event-function not working with 2.17.6 ?
Date: Mon, 12 Nov 2012 07:20:22 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.2.50 (gnu/linux)

Thomas Morley <address@hidden> 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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]