all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Paul Pogonyshev <pogonyshev@gmail.com>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: 26073@debbugs.gnu.org
Subject: bug#26073: workaround
Date: Thu, 28 Sep 2017 19:18:05 +0200	[thread overview]
Message-ID: <CAG7BpapBO3qvZsxw5TbyLNL5o0S1ZKcRcvZKwcihRwcP+aJNpg@mail.gmail.com> (raw)
In-Reply-To: <jwv4lrppozo.fsf-monnier+bug#26073@gnu.org>

[-- Attachment #1: Type: text/plain, Size: 2446 bytes --]

I frankly don't know how it should behave and whether fixing it for
generators would break 'with-slots'. What I can see, however, is that
generator functions with nested lambdas do not work properly. And you
cannot realisctically say "don't use those", because lambdas can be just
introduced by macros without you even thinking about it. And then the
function unexpectedly produces wrong results without any hint of what might
be wrong.

Paul

On 26 September 2017 at 16:38, Stefan Monnier <monnier@iro.umontreal.ca>
wrote:

> retitle 26073 How should cl-symbol-macrolet interact with rebindings?
> thanks
>
> The problem here is indeed different from the one in bug#26068.
> bug#26068 was clearly triggering a (known) bug in cl-symbol-macrolet.
>
> Here it's triggering a (known) misfeature.  The source code has the
> following comments about it:
>
>              ;; CL's symbol-macrolet treats re-bindings as candidates for
>              ;; expansion (turning the let into a letf if needed),
> contrary to
>              ;; Common-Lisp where such re-bindings hide the symbol-macro.
> and
>             ;; FIXME: The behavior of CL made sense in a dynamically scoped
>             ;; language, but for lexical scoping, Common-Lisp's behavior
> might
>             ;; make more sense (and indeed, CL behaves like Common-Lisp
> w.r.t
>             ;; lexical-let), so maybe we should adjust the behavior based
> on
>             ;; the use of lexical-binding.
>
> more concretely cl-symbol-macrolet implements the following semantics:
>
>       (cl-symbol-macrolet ((x <e>))
>         ... (let ((x <foo>)) ..x..))
>     =>
>         ... (cl-letf ((<e> <foo>)) ..<e>..)
>
> whereas Common-Lisp's symbol-macrolet wants the following semantics
> instead:
>
>     => ... (let ((x <foo>)) ..x..)
>
> As mentioned in the comment, it probably makes sense to change
> cl-symbol-macrolet in lexical-binding code to follow Common-Lisp's
> semantics (tho we'd want to give access to the old semantics if the user
> explicitly uses cl-letf).
>
> Not sure what might break if we do that: the main user of
> cl-symbol-macrolet outside of generator.el AFAIK is the with-slots of
> eieio, so the question is whether some users of with-slots expect
> a subsequent `let` binding to temporarily change the slot's value.
> I just checked and it seems that no code in Emacs itself relies on this
> behavior, so maybe it's "safe" to change it.
>
>
>         Stefan
>

[-- Attachment #2: Type: text/html, Size: 3153 bytes --]

  reply	other threads:[~2017-09-28 17:18 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-12 13:25 bug#26073: bug in generator function with nested dash anaphoric macros Paul Pogonyshev
2017-03-12 14:05 ` bug#26073: Simplified testcase Paul Pogonyshev
2017-03-19 19:31 ` bug#26073: workaround Paul Pogonyshev
2017-03-20  0:49   ` Stefan Monnier
2017-03-20  9:04     ` Paul Pogonyshev
2017-03-20  9:22       ` Paul Pogonyshev
2017-09-26 14:38         ` Stefan Monnier
2017-09-28 17:18           ` Paul Pogonyshev [this message]
2017-09-28 20:07             ` Stefan Monnier
2017-09-28 19:39           ` Philipp Stephani
2017-09-28 20:09             ` Stefan Monnier
2017-11-27 20:34             ` Stefan Monnier
2018-02-09  0:34               ` Noam Postavsky
2018-02-09  2:43                 ` Stefan Monnier
2018-02-15  2:37                   ` Noam Postavsky
2017-03-20 13:25       ` Stefan Monnier
2017-03-20 14:20         ` Paul Pogonyshev

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

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

  git send-email \
    --in-reply-to=CAG7BpapBO3qvZsxw5TbyLNL5o0S1ZKcRcvZKwcihRwcP+aJNpg@mail.gmail.com \
    --to=pogonyshev@gmail.com \
    --cc=26073@debbugs.gnu.org \
    --cc=monnier@iro.umontreal.ca \
    /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 external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.