bug-lilypond
[Top][All Lists]
Advanced

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

Issue 1984 in lilypond: Patch: parser.yy: make Scheme and music expressi


From: lilypond
Subject: Issue 1984 in lilypond: Patch: parser.yy: make Scheme and music expressions equivalent as function arguments.
Date: Sat, 22 Oct 2011 15:18:49 +0000

Status: New
Owner: ----
Labels: Type-Enhancement Patch-new

New issue 1984 by address@hidden: Patch: parser.yy: make Scheme and music expressions equivalent as function arguments.
http://code.google.com/p/lilypond/issues/detail?id=1984

parser.yy: make Scheme and music expressions equivalent as function arguments.

This is on top of the work committed to dev/staging.  It makes music
and Scheme expressions equivalent as function arguments.

That means you can write something like
\void \displayLilyMusic <c' d'>4
and have the music displayed, but not interpreted.

Or you do something like
music = #(define-music-function (parser location m) (ly:music?) m)

And then use
\music #(make-music 'EventChord ...)
to integrate Scheme-written music into a music expression (this is not
yet the default: Scheme expressions get ignored outside of constructs
asking for them).

There is one snag in \lyricsmode: strings are indistinguishable from
music consisting of lyric events.  So a string is first interpreted as
music.  If a music argument is rejected by a function predicate,
Lilypond looks whether it is a lyric-event, and in case that it is,
extracts the text and tries passing it off to the predicate again.

Since there is no reliable way to distinguish a lyric-event with
default duration and one with explicit duration, this means that a
duration might silently disappear when a function expecting a string
is called in lyrics mode and gets a string followed by a duration.
Ugly.  But apart from that, this was quite smooth to do.

Error reporting for bad arguments has been improved somewhat.  Bad
arguments without specified defaults keep the function from being
called at all.  Instead a defining-function specific default (like a
void music function or a #f Scheme expression, or a (begin) void
expression) is substituted.

The only argument predicates special in music now are durations and
pitches.  All the rest is interchangeable at will.

http://codereview.appspot.com/5295054




reply via email to

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