[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: A few questions regarding markup
From: |
David Kastrup |
Subject: |
Re: A few questions regarding markup |
Date: |
Sun, 15 Nov 2009 21:06:34 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/23.1.50 (gnu/linux) |
Reinhold Kainhofer <address@hidden> writes:
> Am Sonntag, 15. November 2009 20:16:51 schrieb Nicolas Sceaux:
>> Le 14 nov. 2009 à 09:29, David Kastrup a écrit :
>> > Now the harp-pedal command defines the property signature
>> >
>> > ((size 1.0)
>> > (harp-pedal-details)
>> > (thickness 0.5))
>> >
>> > So far, so fine. It
>> > then calls make-harp-pedal without passing it those let-bound
>> > variables. As far as I understand Scheme and its closures, this means
>> > that the defaults specified in this manner are ignored.
>
> I wrote that code, and I have to admit that I don't understand this part at
> all. I simply copied code from somewhere else and tweaked it so that it
> worked....
>
>> > make-harp-pedal then starts off with
>> >
>> > (let* ((size (chain-assoc-get 'size props 1.2))
>> > (details (chain-assoc-get 'harp-pedal-details props '()))
>>
>> Just remove the useless binding of `size' in the let form,
>> and give the appropriate default in the property argument.
>
> Ah, interesting... So, in the make-harp-pedal function, the properties
> defined in the harp-pedal markup function are available?
Not if make-harp-pedal is not defined in the scope of the harp-pedal
markup function. If I understand Scheme correctly. size is
automatically let-bound to the correct value (default if not specified
in properties) within the markup function defined with
define-builtin-markup-command.
> That's cool!
Yes and no: the coolness does not inherit into called functions. My
personal preference with the harp pedals would be to throw out
make-harp-pedal altogether (it is just used as a shared helper function
for an outcommented different definition which should likely just get
removed altogether).
But I think I covered most issues in my first post anyway.
--
David Kastrup