2013/5/23 David Kastrup <d...@gnu.org>:
> Thomas Morley <thomasmorle...@gmail.com> 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
> lilypond-user@gnu.org
> 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

_______________________________________________
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user

Reply via email to