lilypond-devel
[Top][All Lists]
Advanced

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

Re: order of function arguments


From: David Kastrup
Subject: Re: order of function arguments
Date: Tue, 23 Apr 2013 21:33:56 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux)

Janek Warchoł <address@hidden> writes:

> OMG, i can't believe i've sent such an unholy mess.  Sorry - i got too
> excited, apparently.
> I meant something like this (unfortunately, this doesn't compile under
> 2.17.13, saying that i have to be in Lyricmode for NoteHead - but at
> least it makes some sense):
>
> foo =
> #(define-music-function (parser location prop value music)
>    (symbol-list-or-symbol? scheme? music?)
>    (if (symbol? prop)
>        #{ \tweak #prop #value #music #}
>        #{ \once\override #prop = #value #}))
>
> {
>   \foo NoteHead.color #red
>   c'1-\foo #color #red ->
> }

Ok, here is the deal: symbol-list-or-symbol? will _always_ convert
something like xxx into a symbol list.  The only time an actual symbol
arrives is when you write #'xxx and that is for compatibility reasons.

Why?  Because it can't decide whether the argument is finished without
looking for . and if we have lookahead anyway...

At any rate: the error is slightly surprising to me but will likely
disappear in 2.17.16.  But since prop will always be a list, the second
call will balk at seeing #color (color likely being undefined), and if
it were #'color, the whole c'1-\foo #'color #red -> would be discarded
as the ignored "music" of the first \foo call anyway.

So I still have a hard time reading any sense into that proposal.

-- 
David Kastrup



reply via email to

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