[Top][All Lists]

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

Re: ly:music-deep-copy and \relative

From: Thomas Morley
Subject: Re: ly:music-deep-copy and \relative
Date: Sat, 25 Apr 2015 15:48:24 +0200

Hi Simon,

2015-04-25 13:17 GMT+02:00 David Kastrup <address@hidden>:
> Simon Albrecht <address@hidden> writes:
>> Hello,
>> as Harm has pointed out, the following example gives unexpected
>> (i.e. different) output:

Well, I didn't say it's unexpected ;)

>> \version "2.19"
>> repeat-note =
>> #(define-music-function (parser location music)(ly:music?)
>>   (make-sequential-music (list music (ly:music-deep-copy music))))
>> \absolute { c'1 \repeat-note c'' }
>> \relative c' { c \repeat-note c'1 }
>> There are several possible ways of handling this:
>> – Document it as a feature of ly:music-deep-copy in its search
>> string. Users would have to circumvent it then.
> Huh?  What makes you think this a "feature" of ly:music-deep-copy ?
> \absolute { c'1 { c'' c'' } }
> \relative c' { c { c'1 c'1 } }

For the printed output it's the same like:
\relative c' { c  c'1 c'1 }

> does exactly the same.
>> – Modify ly:music-deep-copy to output both copies in the same
>> octave.
> Both copies _are_ the same before \relative is applied to the music.
>> This would be most intuitive for what I think, since one would expect
>> copies to be identical.
> They are.
>> – Provide an optional (?) second argument to ly:music-deep-copy to
>> choose between the two behaviours: abs-copy to use \relative only for
>> determining the start of the first copy and start the second copy from
>> the same absolute pitch; rel-copy to apply \relative also on the first
>> note of the second copy (as in current behaviour).  – Use two
>> dedicated functions for these two ways of handling it. What would they
>> be named? I’d suggest ly:music-deep-copy-relative (current behaviour)
>> and ly:music-deep-copy (new behaviour).
> You are completely wrong about this having _anything_ to do with
> ly:music-deep-copy.  This is a matter of applying \relative to any kind
> of computed music: that's always likely to lead to surprises.
> Leave the ly:music-deep-copy off, and things get quite weirder since
> then it is the identical music getting transformed by \relative: while
> the result will contain identical octaves for both instances, they will
> be _way_ too high because of \relative working twice on the same
> expression.

David's completely right!
I start to regret having mentioned ly:music-deep-copy at all.
To demonstrate different behaviour of \relative and \absolute this
would have been sufficient:

repeat-note =
#(define-music-function (parser location music)(ly:music?)
  #{ $music $music #})

> You might get along using the make-relative macro.  In this case, it
> would apply like
> \version "2.18.0"
> repeat-note =
> #(define-music-function (parser location music)(ly:music?)
>   (make-relative (music) #{ $music $music #}))
> --
> David Kastrup

make-relative is the sort of additional code I wrote about.

My little function should only point out a difference between
\relative and \abolute. Nothing else.
There's no bug (and no feature).
Sorry if it caused confusion.


reply via email to

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