lilypond-devel
[Top][All Lists]
Advanced

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

Re: Improve implementation of dashed slurs


From: Carl D. Sorensen
Subject: Re: Improve implementation of dashed slurs
Date: Sat, 18 Apr 2009 21:52:40 -0600



On 4/18/09 9:26 PM, "Joe Neeman" <address@hidden> wrote:

> On Sat, 2009-04-18 at 21:08 -0600, Carl D. Sorensen wrote:
>> 
>> 
>> On 4/18/09 7:56 PM, "Joe Neeman" <address@hidden> wrote:
>> 
>> 
>> If I do change to static typing, then I should have one routine that is
>> called from all three places, something like scm2dash_definition.  If I were
>> to write such a function, where would I put it?  It seems like
>> lily/lily-guile.cc is supposed to contain more general things than this
>> would be.
>> 
>> I could make it part of Lookup, and call it there, but it's not really
>> consistent with a Lookup:: function, since they're supposed to be stencils.
>> I could put it in lily/misc.cc, but it doesn't seem much like those
>> functions.
>> 
>> How about if I added it to Slur::, so we had a Slur::parse_dash_definition,
>> and then I could call it from Slur::print, Tie::print, and Arpeggio::print?
>> That seems to make sense to me.
> 
> Of those options, I prefer lily-guile.cc because Dash_definition is
> probably useful more generally than just for slurs (maybe it will be
> used for line spanners in the future?).
> 
> Another option would be to make Dash_definition a smob (like Pitch, for
> example) and provide a ly:make-dash-definition function. This has the
> disadvantage, though, that it makes the ly code more verbose:
> 
> \override Slur #'dash-definition =
> `(,(ly:make-dash-definition 0 0.25 1 1)
> ,(ly:make-dash-definition 0.3 0.7 0.4 0.75) etc..)

The elements of dash-definition are actually called dash-element in the
documentation, not dash-definition. So I'd want to make both Dash_definition
and Dash_element smobs, and provide ly:make-dash-element and
ly:make-dash-definition.

Yes, it would make the ly code more verbose, but it would also allow
better parsing, with better feedback to the user.  And it could avoid the
use of ` and , which are confusing to users.  It could be something like

\override Slur #'dash-definition =
  #(ly:make-dash-definition (list (ly:make-dash-element 0 0.25 1 1)
                                  (ly:make-dash-element 0.3 0.7 0.4 0.75))))

It seems kind of redundant to have ly:make-dash-definition and ly:make-dash
element both basically equivalent to list, but it would allow strong type
checking, because ly:make-dash-definition would require a list of
Dash_elements.

So, given this discussion, do you think we want to go down this path?  Or
should we just leave it as is?

Thanks,

Carl

> 
> Joe
> 
> 





reply via email to

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