Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(151)

Issue 7303057: Issue 754: don't transpose generic property-setting music commands (Closed)

Can't Edit
Can't Publish+Mail
Start Review
Created:
11 years, 3 months ago by dak
Modified:
11 years, 2 months ago
Reviewers:
Keith
CC:
lilypond-devel_gnu.org
Visibility:
Public.

Description

Issue 754: don't transpose generic property-setting music commands The actual issue was that \transpose c e { \transposition bes ... } created a Midi corresponding to an instrument using a transposition of ges, leaving the Midi unchanged. Making the generic property-setting commands (\set and \override) impervious to transposition will also keep \transpose from tampering with user-set values. This is particularly important since the pitch data type in LilyPond is also being used for signifying intervals or pitch differences rather than absolute pitches.

Patch Set 1 #

Patch Set 2 : Cherry-pick DOC change from other approach. #

Total comments: 2
Unified diffs Side-by-side diffs Delta from patch set Stats (+3 lines, -2 lines) Patch
M input/regression/quote-transposition.ly View 1 1 chunk +1 line, -2 lines 0 comments Download
M scm/define-music-types.scm View 2 chunks +2 lines, -0 lines 2 comments Download

Messages

Total messages: 11
dak
Cherry-pick DOC change from other approach.
11 years, 3 months ago (2013-02-07 14:19:55 UTC) #1
Keith
Yesterday's patch was better. The 'untransposable property is more closely related to the source of ...
11 years, 3 months ago (2013-02-08 04:46:27 UTC) #2
dak
On 2013/02/08 04:46:27, Keith wrote: > Yesterday's patch was better. I beg to differ. It ...
11 years, 3 months ago (2013-02-08 08:40:29 UTC) #3
dak
On 2013/02/08 08:40:29, dak wrote: > On 2013/02/08 04:46:27, Keith wrote: > > Yesterday's patch ...
11 years, 3 months ago (2013-02-08 09:20:58 UTC) #4
Keith
On Fri, 08 Feb 2013 01:20:59 -0800, <dak@gnu.org> wrote: > On 2013/02/08 08:40:29, dak wrote: ...
11 years, 3 months ago (2013-02-09 05:46:45 UTC) #5
dak
On 2013/02/09 05:46:45, Keith wrote: > On Fri, 08 Feb 2013 01:20:59 -0800, <mailto:dak@gnu.org> wrote: ...
11 years, 3 months ago (2013-02-09 08:54:03 UTC) #6
Keith
On 2013/02/09 08:54:03, dak wrote: > It doesn't matter. LilyPond is still being actively maintained. ...
11 years, 3 months ago (2013-02-11 06:18:57 UTC) #7
dak
On 2013/02/11 06:18:57, Keith wrote: > On 2013/02/09 08:54:03, dak wrote: > > > It ...
11 years, 3 months ago (2013-02-11 09:25:20 UTC) #8
dak
On 2013/02/11 09:25:20, dak wrote: > On 2013/02/11 06:18:57, Keith wrote: > > On 2013/02/09 ...
11 years, 3 months ago (2013-02-11 12:39:02 UTC) #9
Keith
On 2013/02/11 12:39:02, dak wrote: > On 2013/02/11 09:25:20, dak wrote: > > On 2013/02/11 ...
11 years, 3 months ago (2013-02-11 20:53:53 UTC) #10
dak
11 years, 3 months ago (2013-02-12 01:18:00 UTC) #11
On 2013/02/11 20:53:53, Keith wrote:
> On 2013/02/11 12:39:02, dak wrote:
> > On 2013/02/11 09:25:20, dak wrote:
> > > On 2013/02/11 06:18:57, Keith wrote:
> > > > 
> > > > I was hoping to be able to provide a backward-compatibility function, as
> in
> 
> > > I did not even look at the proposed patch but it touches several binaries.

> > That
> > > should not be necessary.  Of course, in this variant of the patch, it
would
> be
> > > feasible just to put untransposable back to #f, but since the followup
work
> > > includes reversing the sign of the pitch again, this is a dead end.  I
think
> > > that something using ApplyContext should be workable, though, so that the
> > > compatibility function gets along just using LilyPond/Scheme and can be
> loaded
> > > on-demand.
> 
> Well, my previous suggestion for backward-compatibility used LilyPond, but you
> promptly adjusted your patch to stop my suggestion from working.
> 
> > oldTransposition =
> > #(define-music-function (parser location pitch) (ly:pitch?)
> >   (make-music 'SequentialMusic
> >    'pitch (ly:pitch-negate pitch)
> >    'elements-callback
> >    (lambda (m)
> >     (list
> >      #{ \transposition $(ly:pitch-negate
> > 			 (ly:music-property m 'pitch))
> >      #}))))
> 
> Great.  The pitches in structures built by make-music (differently to those
> created by property-set) are molested by \transpose, but then a sneaky
callback
> tampers with the music and creates -- wait for it -- a nested
property-set!

The copy&paste job does not match what happens here.  In this case,
transpose manipulates a pitch field that is by naming and function
_chosen_ to get acted upon.  That's not the abomination.  The
abomination is using a music type intended for something different and
printing as something different for setting a transposition using a
callback not intended for it.

Arguably, one should rather use TransposedMusic or similar for this
abomination.  However, this would involve tampering _both_ with
elements-callback as well as iterator-ctor.  And TransposedMusic does
not really have anything to do with \transposition except by relation
of the names.

I'd have preferred, in order of priority, using something like
a) ApplyContext.  This would not have access to the event, however.
b) a user-defined event.  We don't have those in a reliable manner
yet.

This is a compatibility hack.  The first version (and most likely also
the ultimate version) did not use #{ ... #} but rather copy&paste from
the internals of \transposition.  However, those are going to change
when I change the sign of instrumentTransposition.  So for better
longevity of this comment, I picked #{ ... #}.

> It just goes to show that people will take advantage of _any_
> reproducible behavior, no matter how inconsistent.

It is a compatibility hack purposefully not affecting _any_ of the
LilyPond code base when not used.  Once user-defined events are more
than a semi-manual hack, I'd use them.  Since they aren't, I chose
this self-contained hack.  I'd not recommend it for user-maintained
code: it relies on SequentialMusic going through elements-callback.
But maintaining this hack through changes of SequentialMusic should be
less work than maintaining explicit code paths in the main code.  We
have still lily_1_8_relative mottled through our code base, and
ripping out this compatibility cruft from versions of 1.8 or earlier
(seriously?!?)  was vetoed because people might have been using it as
a user choice option.

Since it seems almost impossible to stamp such compatibility cruft
out, I prefer not letting it in in the first place.

> Just kidding.

Sure, but the amount of hypocrisy of mine that you are basing the
kidding on might be different from what you thing and/or suggest, so I
prefer to have this in the open.

> This should be fine for a backward-compatibility function, in case
> anyone has a 200-page score that accidentally depended on the old
> behavior.

The situation is worse than that.  The mailing list carries examples
where people have purposefully rather than accidentally based their
code on the old behavior.  And in light of the available
documentation, I can't blame them for doing experimentation and taking
bad choices, choices that it takes someone with a clue about
maintainability, predictability and system design to do right.

So we are not talking about "accidentally" but rather "imprudently"
or, as that level of prudence is nothing to require of a user,
"unwisely" here.

Curing the fallout with documentation, convert-ly rules and backward
compatibility include file will be much more of a wart and disgrace
than the above code.
Sign in to reply to this message.

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b