lilypond-user
[Top][All Lists]
Advanced

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

Re: LSR-snippet 878: Customizing individual staff lines


From: Thomas Morley
Subject: Re: LSR-snippet 878: Customizing individual staff lines
Date: Sun, 26 May 2013 23:30:56 +0200

2013/5/23 David Kastrup <address@hidden>:
> Thomas Morley <address@hidden> writes:
>
>> To the author of LSR-snippet 878: Customizing individual staff lines
>> (currently not approved)
>> http://lsr.dsi.unimi.it/LSR/Item?id=878
>> Hope you're on this list.
>>
>> I had a look at your file and noticed a small gap when the normal
>> staff is restored. Visible with high zoom.
>>
>> What do you think about the modified code below.
>> (In the example I've set 'layer and 'color to gain better visibility.)
>>
>> \version "2.14.2"
>>
>> #(define-public ((custom-staff-lines . rest) grob)
>>
>>    (define (index-cell cell dir)
>>      (if (equal? dir RIGHT)
>>          (cdr cell)
>>          (car cell)))
>
> That's the same as interval-bound
>
>>    (define (index-set-cell! x dir val)
>>      (case dir
>>        ((-1) (set-car! x val))
>>        ((1) (set-cdr! x val))))
>
> Not necessarily schemeish in its destructive way.
>
>>    (let* ((common (ly:grob-system grob))
>>           (span-points '(0 . 0))
>
> [...]
>
>>             (set-cdr! span-points width)
>
> And right here
>
>>               (index-set-cell! span-points dir
>>                                (ly:grob-relative-coordinate bound common X))
>
> and here this breach of Scheme philosophy blows up around the code.
>
> '(0 . 0) is a _constant_.  It will denote the _same_ global cons cell
> throughout the whole code base, and it is getting written and read all
> over the place.
>
> Overwriting literally constant pairs is undefined behavior.  In Guilev1,
> it will likely lead to bad surprises like values changing that you don't
> expect to change, because they are still sharing the same cons cell with
> code running later.  In Guilev2, it might just throw an error.
>
> --
> David Kastrup
>
>
> _______________________________________________
> lilypond-user mailing list
> address@hidden
> https://lists.gnu.org/mailman/listinfo/lilypond-user

Hi David,

thanks for looking in it that thoroughly, much more than I did.

I've the feeling that the whole snippet, always using setting <this>
and resetting <that>, is not very schemeish at all.
Perhaps it should be rewritten.
Though, it's not my own snippet and I've not the time and motivation
to try it myself.

What to do now?
Approving it as it stands? (The author didn't reply till now.)
And waiting till it breaks?

Phil, what do you mean?

-Harm



reply via email to

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