From: Michael Heerdegen <michael_heerdegen@web.de>
To: 59140@debbugs.gnu.org
Cc: okamsn@protonmail.com
Subject: bug#59140: 29.0.50; iter-yield from lambda
Date: Wed, 09 Nov 2022 02:22:56 +0100 [thread overview]
Message-ID: <87sfissyz3.fsf@web.de> (raw)
Hello,
In emacs-help (Okamsn <okamsn@protonmail.com>) it has been pointed to
the issue that `iter-yield' (from generator.el) is not supported in some
contexts - contexts where yielding happens from inside a lambda
expression or directly (like here when mapping over a sequence), e.g.
(setq iter-maker (iter-lambda (x)
(seq-doseq (item x)
(iter-yield item))))
(setq my-iter (funcall iter-maker '(1 2 3)))
(iter-next my-iter)
~~> (void-function cps-internal-yield)
(seq-doseq expands to more or less just mapc+lambda) or
(setq iter-maker (iter-lambda (x)
(seq-do #'iter-yield x)))
(setq my-iter (funcall iter-maker '(1 2 3)))
(iter-next my-iter)
~~> (error "‘iter-yield’ used outside a generator")
These examples are written correctly but seem to hit an undocumented
limitation of the implementation in generator.el
I quote Stefan Monnier answering what should be done:
> IIRC, one of the main limitations of `generator.el` is that it doesn't
> handle `lambda` (and neither should you use `#'iter-yield`, IIRC).
>
> I don't really know how to go about fixing it.
>
> A good first step would be to make sure it emits an error (or a warning)
> when you use `#'iter-yield` or when you call `#'iter-yield` from with
> a lambda expression.
TIA,
Michael.
next reply other threads:[~2022-11-09 1:22 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-09 1:22 Michael Heerdegen [this message]
2023-09-15 19:56 ` bug#59140: 29.0.50; iter-yield from lambda Max Brieiev
2023-09-15 22:18 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-09-16 19:39 ` Max Brieiev
2023-09-16 21:31 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-09-16 1:56 ` Michael Heerdegen
2023-09-17 6:32 ` Max Brieiev
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=87sfissyz3.fsf@web.de \
--to=michael_heerdegen@web.de \
--cc=59140@debbugs.gnu.org \
--cc=okamsn@protonmail.com \
/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.