[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Scheme engraver structure questions
From: |
David Kastrup |
Subject: |
Re: Scheme engraver structure questions |
Date: |
Wed, 10 Feb 2010 09:27:24 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/23.1.90 (gnu/linux) |
Nicolas Sceaux <address@hidden> writes:
> Le 9 févr. 2010 à 21:32, David Kastrup a écrit :
>
>> If you really must, you should probably use make-procedure-with-setter
>> in order to be able to use
>>
>> (define (engraver-method engraver 'initialize) ...
>
> According to:
>
>
> <http://www.gnu.org/software/guile/manual/html_node/Adding-or-Setting-Alist-Entries.html>
>
> "The only safe way to update an association list variable when adding or
> replacing an entry like this is to set! the variable to the returned value"
>
> You cannot just assoc-set! an associative list. So a procedure with setter
> does not help in that case (unless I've misunderstood something).
Well, there are several ways to address this problem.
But the most obvious one is that a Scheme engraver may contain an
association list, and currently may be specified as one in a list of
engravers, but should itself be a recognizable data structure, even if
it just means that its associations start with a known car, like
'(engraver (initialize . ...
or
'((type . engraver) (...
One reason is that it has to be identifiable by ly:translator?. But
personally, I'd make it a separate data structure internally containing
either the association list, or a number of fields that are initialized
from such an association list. _If_ we want to support the current
syntactic entry of anonymous engravers. Which I don't necessarily
consider a good idea. It might be preferable for an anonymous form to
look like
(make-engraver #:initialize (lambda () ...) #:finalize ...)
since that saves the programmer the bother of messing with quoting.
--
David Kastrup