From: Andy Wingo <wingo@pobox.com>
To: Ken Raeburn <raeburn@raeburn.org>
Cc: Daniel Kraft <d@domob.eu>, guile-devel <guile-devel@gnu.org>,
Neil Jerram <neil@ossau.uklinux.net>
Subject: Re: Elisp flet construct
Date: Fri, 24 Jul 2009 00:50:18 +0200 [thread overview]
Message-ID: <m3bpnbdnf9.fsf@pobox.com> (raw)
In-Reply-To: <77604984-FD40-423B-B6FB-4333AF5F0729@raeburn.org> (Ken Raeburn's message of "Thu, 23 Jul 2009 17:53:21 -0400")
On Thu 23 Jul 2009 23:53, Ken Raeburn <raeburn@raeburn.org> writes:
> On Jul 23, 2009, at 16:46, Andy Wingo wrote:
>> On Tue 21 Jul 2009 15:10, Daniel Kraft <d@domob.eu> writes:
>> Just a little addition to the subject of extensions: I'd very much
>> like
>>> to add lexical-let and lexical-let* as another set of extensions,
>>> because this gives the possibility to use "fast" lexical variables
>>> without the dynamic-scoping-fluid-pain.
>>
>> Yes, yes. I totally agree. This allows stack allocation of the
>> variables
>> as well, which can be a significant speed win (because of not making
>> so
>> much garbage).
>
> In some cases, but not all. Consider the Lisp version of an example I
> remember from my Scheme intro class:
>
> (defun make-counter ()
> (lexical-let ((count 0))
> (lambda ()
> (setq count (+ 1 count))
> count)))
Of course :) But with lexical scoping you can statically determine when
variables are assigned. The tree-il->glil compiler already does this.
> Without lambda or defun forms inside the lexical-let, yes, I think stack
> slots can be used. (Well, I'm kind of fuzzy on the whole call/ cc
> thing, but I assume that's already addressed elsewhere....)
If the continuation may be captured, you have to heap-allocate mutated
vars. So we just heap-allocate all mutated vars.
Cheers,
Andy
--
http://wingolog.org/
next prev parent reply other threads:[~2009-07-23 22:50 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-07-20 17:53 Elisp flet construct Daniel Kraft
2009-07-21 13:10 ` Daniel Kraft
2009-07-21 18:35 ` Ken Raeburn
2009-07-21 19:32 ` Daniel Kraft
2009-07-21 21:33 ` Ken Raeburn
2009-07-23 20:46 ` Andy Wingo
2009-07-23 21:53 ` Ken Raeburn
2009-07-23 22:50 ` Andy Wingo [this message]
2009-07-24 6:38 ` Daniel Kraft
2009-07-23 20:44 ` Andy Wingo
2009-07-24 6:26 ` Daniel Kraft
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/guile/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=m3bpnbdnf9.fsf@pobox.com \
--to=wingo@pobox.com \
--cc=d@domob.eu \
--cc=guile-devel@gnu.org \
--cc=neil@ossau.uklinux.net \
--cc=raeburn@raeburn.org \
/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.
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).