unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Stefan Monnier <monnier@iro.umontreal.ca>
To: Michael Heerdegen <michael_heerdegen@web.de>
Cc: emacs-devel@gnu.org
Subject: Re: gv-exander for 'list'
Date: Tue, 19 Mar 2019 20:38:00 -0400	[thread overview]
Message-ID: <jwvmulqs86h.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <87sgviqys2.fsf@web.de> (Michael Heerdegen's message of "Tue, 19 Mar 2019 23:34:21 +0100")

>> > +(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



  reply	other threads:[~2019-03-20  0:38 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-19 16:39 gv-exander for 'list' Michael Heerdegen
2019-03-19 18:41 ` Stefan Monnier
2019-03-19 22:34   ` Michael Heerdegen
2019-03-20  0:38     ` Stefan Monnier [this message]
2019-03-20 18:15       ` Michael Heerdegen
2019-03-20 19:06         ` Stefan Monnier
2019-03-20 20:03           ` Michael Heerdegen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=jwvmulqs86h.fsf-monnier+emacs@gnu.org \
    --to=monnier@iro.umontreal.ca \
    --cc=emacs-devel@gnu.org \
    --cc=michael_heerdegen@web.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).