Valentin Villenave <valen...@villenave.net> writes:

> On Fri, Oct 29, 2010 at 12:46 PM, David Kastrup <d...@gnu.org> wrote:
>>
>> Are there good reasons left for not allowing music functions to take
>> pitches as arguments?  That would allow implementing something like
>> \transpose as a music function.  The alternative, letting it take a
>> music event and not checking its duration and hoping that it is a single
>> note, seems quite less elegant.
>
> Music functions *can* take a ly:pitch as argument:
>
> toto =
> #(define-music-function (parser location pitch) (ly:pitch?)
>    (make-music 'NoteEvent
>      'duration (ly:make-duration 2 0 1 1)
>      'pitch pitch))
>
> { a \toto #(ly:make-pitch 0 0 0) b }
>
> However, having to type #(ly:make-pitch x x x) is hardly convenient
> from a user point of view.

That is taking a scheme expression, not a pitch as argument.

>> Since argument signatures of music functions and markup functions are
>> by now processed as lists instead of fixed combinations, adding new
>> argument types does not seem to have significant drawbacks.
>
> I may be totally wrong, but it seems to me that what you're suggesting
> amounts to actually create a new type, that would be a one-note
> ly:music type whose duration is disregarded. (I'm not saying it would
> be a bad idea, though.)

That is exactly what I don't want.  I could already have that.  I want
something that takes a pitch as an argument and complains about getting
anything else with it: duration, accents, whatever.

Just like \transpose would complain about getting anything but a pitch
as its transposition pitch argument.

-- 
David Kastrup


_______________________________________________
lilypond-devel mailing list
lilypond-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/lilypond-devel

Reply via email to