On Mon, Jul 22, 2013 at 12:06 PM, David Kastrup <[email protected]> wrote:

> David Nalesnik <[email protected]> writes:
>
> >  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.
>
> That's a misconception.  You can't apply set-car! or set-cdr! to '()
> since '() has neither car nor cdr, not being a pair.
>

Sorry--I meant applying set-car! or set-cdr! to (cons '() '())
>From your explanations below, I understand why this is OK.  It's really no
different that applying set-car! to (cons 5 6)


>
> > (2) Should '() in all variable definitions, set! expressions be changed
> to
> > (list) ?
>
> No, '() is just fine and safe.  It is a constant like 7, #t or #f and
> 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.


Eek.  So that means that the variable all-grob-descriptions should be
modified to some monstrosity using list and cons, or else the actions of
completize-grob-entry and lines like

 (set! all-grob-descriptions (sort all-grob-descriptions alist<?))

at the bottom of define-grobs.scm

ought to be done manually or else there could be problems in guilev2?

Thanks,
David
_______________________________________________
lilypond-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/lilypond-devel

Reply via email to