lilypond-devel
[Top][All Lists]
Advanced

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

How do feel people about the following change in syntax?


From: David Kastrup
Subject: How do feel people about the following change in syntax?
Date: Wed, 12 Oct 2011 17:42:47 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux)

Hi,

I am currently trying to make music functions more powerful, in
particular their argument predicates.  Also I am trying to relieve the
parser from responsibilities.

Now I have a possibly slightly contentious change...  I want to let { }
mimic the new functionality of #{ #} instead of creating sequential
music unconditionally.  That means the following:

                      previously equivalent to    now equivalent to
{ 2+3 }               \sequential { }             5
{ }                   \sequential { }             void-music
{ \with ... }         syntax error                context-modification
{ c4 }                \sequential { c4 }          simple-music

I also want to have the equivalent of ly:export applied to every
embedded-scheme expression.  Currently, Scheme expressions are mostly
ignored unless explicitly requested.  Scheme expressions returning an
unspecified value (like (begin) does) will, of course, still be
ignored.  Likely also most Scheme expressions not returning anything
useful in a music sequence.

#"string" will be equivalent to "string" or { "str" + #"ing" }.
Something like 3\cm will not be useful in function arguments (it is
indistinguishable from _two_ arguments), but you can write { 3\cm }
instead.  Indeed, inside of Lilypond, ##{ ... #} and { ... } would be
pretty much the same.

While the ly:music? predicate remains important in the parser for
parsing music that is not recognizable as such without context (and
ly:pitch? and ly:duration? remain completely indispensible), you can
still write predicates like
(lambda(x)(or (ly:music? x) (markup? x) (integer? x))) if you want to,
and they will work for music that is uniquely recognizable as such
without lookahead, like { c4 a4 } or so.

Oh, and another idea: the last argument of a function can't currently be
optional since it would require too much lookahead.  And there are some
combinations of optional arguments that don't combine too well (one
reason I prefer that after omitting one optional argument, the rest is
skipped as well).  But for leaving an optionally defined argument at its
default without getting into lookahead hell, one could just specify
\default.  I had originally planned to replace it with #f, but it seems
like letting it retain the status of a reserved word makes more sense.

It would be my guess that by far most valid documents designed as
documents (rather than as stress test) would retain their meaning.

But for new documents, basically losing most barriers between Scheme and
Lilypond might put Lilypond writers on a friendlier footing with
Scheme.

Comments?

-- 
David Kastrup




reply via email to

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