From: Stefan Monnier <monnier@iro.umontreal.ca>
To: Michael Heerdegen <michael_heerdegen@web.de>
Cc: Nicolas Petton <nicolas@petton.fr>,
Emacs Development <emacs-devel@gnu.org>
Subject: Re: thunk.el: Document that thunk-force == funcall?
Date: Tue, 17 Nov 2020 16:51:22 -0500 [thread overview]
Message-ID: <jwv4klnejwi.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <871rgs3tdx.fsf@web.de> (Michael Heerdegen's message of "Tue, 17 Nov 2020 16:17:14 +0100")
Michael Heerdegen [2020-11-17 16:17:14] wrote:
> The background: because thunks are functions, one is allowed (and it is
> useful) to directly pass them to higher order functions e.g. as a test
> predicate, or bind them using `cl-flet', or `cl-letf' to a
> `symbol-function' place. Currently, the official solution would require
> to use a lambda wrapper.
I like the idea that we could replace the current representation with
something more like a `defstruct`, so I'm on the side of "don't document
that thunks *are* functions", but it's not a very strong opinion.
In any case even without documenting them to be functions, we could
provide
(defalias 'thunk-function #'identity)
to avoid the wasteful use of a lambda wrapper.
> I have encountered this requirement several times (and using `thunk-let'
> was not always the solution) - thus my question.
[...]
> Say the code loops over a list of files or so (not known at think time).
> The thunk could "contain" a test that might take long (e.g. something
> that might need to look at the file's contents) but the result is
> interesting only sometimes, depending on the result of other tests (also
> not known at think time).
[ That's still pretty hypothetical. ]
I'd be curious to see concrete examples, to get a better idea of
the tradeoffs.
Stefan
next prev parent reply other threads:[~2020-11-17 21:51 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-11-17 15:17 thunk.el: Document that thunk-force == funcall? Michael Heerdegen
2020-11-17 17:08 ` Tomas Hlavaty
2020-11-17 17:38 ` Michael Heerdegen
2020-11-17 18:09 ` Tomas Hlavaty
2020-11-17 21:07 ` Michael Heerdegen
2020-11-17 22:42 ` Tomas Hlavaty
2020-11-17 23:52 ` Stefan Monnier
2020-11-18 8:01 ` Tomas Hlavaty
2020-11-18 14:04 ` Stefan Monnier
2020-11-18 22:19 ` Tomas Hlavaty
2020-11-18 22:49 ` Stefan Monnier
2020-11-18 23:13 ` Tomas Hlavaty
2020-11-18 23:40 ` Stephen Leake
2020-11-18 9:04 ` Alfred M. Szmidt
2020-11-18 22:21 ` Tomas Hlavaty
2020-11-17 17:32 ` Drew Adams
2020-11-18 23:05 ` Tomas Hlavaty
2020-11-18 23:25 ` Tomas Hlavaty
2020-11-19 11:50 ` Mattias Engdegård
2020-11-19 18:14 ` Tomas Hlavaty
2020-11-19 17:18 ` Tomas Hlavaty
2020-11-19 9:49 ` Nicolas Petton
2020-11-17 21:51 ` Stefan Monnier [this message]
2020-11-25 14:16 ` Michael Heerdegen
2020-11-27 17:22 ` Michael Heerdegen
2020-12-17 4:37 ` Michael Heerdegen
2020-12-18 2:58 ` Adam Porter
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=jwv4klnejwi.fsf-monnier+emacs@gnu.org \
--to=monnier@iro.umontreal.ca \
--cc=emacs-devel@gnu.org \
--cc=michael_heerdegen@web.de \
--cc=nicolas@petton.fr \
/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.