[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: gv-exander for 'list'
From: |
Stefan Monnier |
Subject: |
Re: gv-exander for 'list' |
Date: |
Tue, 19 Mar 2019 20:38:00 -0400 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) |
>> > +(put 'list 'gv-expander
>> > + (lambda (do &rest elt-places)
>> > + ;; FIXME: when using this with letf people would expect this to
>> > + ;; create local bindings
>>
>> Not sure what you mean by this FIXME.
>
> I mean that something like
>
> (cl-letf (((list a) (list 1)))
> a)
>
> errors unless variable a is already bound.
Oh, right, that too.
> I think I just would want simple variables in `list' treated the same way.
Indeed, but the GV infrastructure doesn't offer any way for cl-letf to
do that correctly (short of ad-hoc hacks that special-case `list`).
There are other GVs where `cl-letf` would like to do something a bit
different than just "get...set". E.g. for buffer-modified-p the setter
should be restore-buffer-modified-p when used in `cl-letf`. I haven't
spent much time trying to solve this problem, tho, because `cl-letf` is
not that important in my opinion.
Personally, I wrote "debatable" for the `cons` and `logand` gv-expanders
but I think they're undesirable. Of the two the `logand` is
probably the most useful one (because `logand` can be considered as
a form of projection, like `aref`, `nth`, `car`, ... whereas `cons`
really doesn't fit the pattern).
Stefan