emacs-devel
[Top][All Lists]
Advanced

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

Re: Why is FUNC in cl-callf not allowed to be an expression?


From: Stefan Monnier
Subject: Re: Why is FUNC in cl-callf not allowed to be an expression?
Date: Wed, 29 May 2019 13:02:59 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)

>> Indeed, they're closely related but symbol-macrolet does not "evaluates"
>> anything at the "binding" site.  Also it can also be used for purposes
>> different from "places", e.g. to keep a log of all the accessed to
>> a "variable" (tho, we could just as well create a (journaled PLACE)
>> pseudo place which would record accesses in the very same way).
>
> I also come to the conclusion that symbol-macrolet and place binding are
> two different things.

Right.  I think you can always use one to implement the functionality of
the other, but they're different.

> OTOH, `symbol-macrolet' might be used for arbitrary calculations.  It
> would be surprising (wrong) if in
>
>     (symbol-macrolet ((r (list (random))))
>       (list r r))
>
> the `random' function would be called only once.

Indeed, with gv-place-bind you'd need to use something like

    (gv-place-bind ((r (gv-cbn (list (random)))))
      (list r r))

for some definition of `gv-cbn` such as

    (defun gv-cbn (x)
      (declare (gv-expander (lambda (do)
                 (funcall do x (lambda (v) `(setf ,x ,v))))))
      x)


-- Stefan




reply via email to

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