|
From: | David Nalesnik |
Subject: | Re: problem with constants in scheme-text-spanner.ly |
Date: | Mon, 22 Jul 2013 13:52:46 -0500 |
David Nalesnik <address@hidden> writes:That's a misconception. You can't apply set-car! or set-cdr! to '()
> All spanners appear when I replace the variable definition
> (event-drul '(() . ()))
>
> with
>
> (cons (list) (list))
>
> and later (line 157):
>
> (set! event-drul '(() . ()))
>
> with
>
> (set! event-drul (cons (list) (list)))
>
> I'd like to fix the problem, but I have several questions:
>
> (1) Would (cons '() '()) be acceptable? The problem is fixed, but I wonder
> about the
> usage of the literal _expression_ '() since there are multiple usages of
> set-car! and set-cdr! applied to the variable.
since '() has neither car nor cdr, not being a pair.
No, '() is just fine and safe. It is a constant like 7, #t or #f and
> (2) Should '() in all variable definitions, set! expressions be changed to
> (list) ?
can't be modified at all. '(() ()) however is a pair. Both its car and
cdr are the constant '() (which can't be changed), but you can replace
its car and cdr. Which is undefined behavior: Scheme is free to throw
an error or actually change the code in every instance or do other
nasties.
So with (cons '() '()) you should be fine.
IIRC, completize-grob-entry running on all-grob-descriptions also
commits this kind of sacrilege.
[Prev in Thread] | Current Thread | [Next in Thread] |