emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Help with recursive destructive function


From: Eric Abrahamsen
Subject: Re: Help with recursive destructive function
Date: Thu, 07 Jun 2018 09:51:09 -0700
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)

Stefan Monnier <address@hidden> writes:

>> I think this function could be useful in many situations, so I'd like to
>> make it fairly general -- gv-refs or values.
>
> Why "or values"?  It's easy for the caller to wrap its argument in
> `(gv-ref ...)` and lets the function be more efficient.

Fair enough, I guess I was just thinking gv-ref will be unfamiliar to
most people, but if the docstring is clear it doesn't matter.

>> How would you feel about gv-ref itself doing a check?
>>
>> (if (and (eq 'closure (caar place))
>>          (eq 'closure (cadr place)))
>>     place
>>   (gv-letplace ...etc...)
>>
>> Too hacky?
>
> Beside the obvious problem of checking equality vs `closure` which will
> break down with byte-compiled code, the more serious problem is that
> this code is run at macro-expansion time, not at run-time, so `place` is
> a Elisp *expression* and not an Elisp *value*.
>
> IOW your test will only trigger when the *source code* is of the form
>
>     (gv-ref ((closure ...) . (closure ...)))

Bleagh, okay. I will stop trying to be clever.

Thanks,
Eric




reply via email to

[Prev in Thread] Current Thread [Next in Thread]