From: Andrea Corallo via "Emacs development discussions." <emacs-devel@gnu.org>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: Zhu Zihao <all_but_last@163.com>, Tomas Hlavaty <tom@logand.com>,
emacs-devel@gnu.org
Subject: Re: named-let
Date: Mon, 11 Jan 2021 23:28:08 +0000 [thread overview]
Message-ID: <xjfr1mrdpfb.fsf@sdf.org> (raw)
In-Reply-To: <jwvturn3wr3.fsf-monnier+emacs@gnu.org> (Stefan Monnier's message of "Mon, 11 Jan 2021 18:10:17 -0500")
Stefan Monnier <monnier@iro.umontreal.ca> writes:
>>> With the advent of the native-compiler, "all implementations" is even
>>> harder to reach, since it means, interpreter, byte-code, and native code.
>> Well as I mentioned the native compiler is already capable of that if
>> asked, but in general whichever optimization is done by the
>> byte-compiler is picked by the native compiler cause currently the
>> compilation input is LAP. So I'm not really sure this is adding much
>> complexity from this POV.
>
> All the patches I've seen so far do it in the bytecode interpreter,
> without changing the bytecode itself.
Ah okay, as not said, indeed it should use a goto in bytecode.
> Note that it also depends on what we mean by TCO.
> To me, the "real TCO" is like what Scheme does (so it's not limited to
> recursive functions). I don't know how easy it is to implement for
> native-comp. Maybe GCC magically does it for us?
Nope, AFAIU it does it, but not for us (ATM) :)
> [ TCO has also undesirable interactions with debugging/tracing, but
> I think that would be a secondary concern which should be
> manageable somehow. ]
It's also a change in semantic as one must assume that `bar' is not
redefining `foo'.
(defun foo ()
(bar)
(foo))
Indeed this does not apply for `named-let' where the scope is lexical
and so you could do the magic :)
>> As a side note I'd be surprised if interpreters in CL implementation are
>> supporting TRE, I guess the interpreter is typically used only for debug
>> or bootstrap therefore should be not very important. Am I wrong?
>
> I wouldn't know. But at least for ELisp , it was perceived that
> the plain interpreter is important enough that if it doesn't support TCO
> then we can't write code which relies on TCO, in which case implementing
> TCO in the bytecode interpreter is not very useful.
>
> [ That's part of the reason why I implemented this limited TCO as
> a macro: it works the same for bytecode as for any other mode of
> execution so it can really be considered part of the guaranteed
> semantics rather than a mere optimization. ]
I see.
Thanks
Andrea
next prev parent reply other threads:[~2021-01-11 23:28 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-01-09 1:43 named-let Stefan Monnier
2021-01-09 8:58 ` named-let tomas
2021-01-09 16:01 ` named-let Joost Kremers
2021-01-09 21:48 ` named-let Stefan Monnier
2021-01-09 15:23 ` named-let Tomas Hlavaty
2021-01-09 16:44 ` named-let Stefan Monnier
2021-01-09 17:03 ` named-let Helmut Eller
2021-01-09 18:43 ` named-let Stefan Monnier
2021-01-09 18:47 ` named-let Tomas Hlavaty
2021-01-10 18:49 ` named-let Zhu Zihao
2021-01-11 22:27 ` named-let Tomas Hlavaty
2021-01-11 22:36 ` named-let Stefan Monnier
2021-01-11 22:48 ` named-let Tomas Hlavaty
2021-01-11 22:50 ` named-let Andrea Corallo via Emacs development discussions.
2021-01-11 23:10 ` named-let Stefan Monnier
2021-01-11 23:28 ` Andrea Corallo via Emacs development discussions. [this message]
2021-01-11 23:57 ` named-let Stefan Monnier
2021-01-12 9:24 ` named-let Andrea Corallo via Emacs development discussions.
2021-01-12 18:07 ` named-let Stefan Monnier
2021-01-12 18:50 ` named-let Andrea Corallo via Emacs development discussions.
2021-01-12 9:13 ` named-let Helmut Eller
2021-01-13 8:11 ` named-let Zhu Zihao
2021-01-13 14:01 ` named-let Stefan Monnier
2021-01-11 22:40 ` named-let Andrea Corallo via Emacs development discussions.
2021-01-11 22:51 ` named-let Tomas Hlavaty
2021-01-11 23:04 ` named-let Andrea Corallo via Emacs development discussions.
2021-01-12 0:12 ` named-let Tomas Hlavaty
2021-01-20 19:44 ` named-let Stefan Monnier
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=xjfr1mrdpfb.fsf@sdf.org \
--to=emacs-devel@gnu.org \
--cc=akrl@sdf.org \
--cc=all_but_last@163.com \
--cc=monnier@iro.umontreal.ca \
--cc=tom@logand.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.