From: Hans Aberg <haberg-1@telia.com>
To: David Kastrup <dak@gnu.org>
Cc: guile-devel@gnu.org
Subject: Re: summary: lilypond, lambda, and local-eval
Date: Fri, 16 Dec 2011 15:57:26 +0100 [thread overview]
Message-ID: <D31F8B2A-FE08-4155-9F8A-097D8A15B76E@telia.com> (raw)
In-Reply-To: <87k45w3cwz.fsf@fencepost.gnu.org>
On 16 Dec 2011, at 13:43, David Kastrup wrote:
>>> Here's what I currently see:
>>>
>>> scheme@(guile-user)> (local-eval #'t (primitive-eval '(let ((t 42))
>>> (or #f (the-environment)))))
>>> ERROR: In procedure memoize-variable-access!:
>>> ERROR: Unbound variable: t
>>>
>>> This is the correct behavior, no?
>>
>> This is what I get when I play around with the following variation of David's code in Guile 2.0.3:
>> (define (xxx)
>> (let* ((x 2))
>> (set! x (+ x 3))
>> (interaction-environment)))
>>
>> (eval '(begin (set! x (+ x 5)) x) (xxx))
>>
>> My guess (correct?) is that one wants some variation of
>> (interaction-environment) that can cause x in the eval expression to
>> bind to the environment returned by (xxx).
>>
>> Might eval be changed to accommodate for that (without introducing the
>> name local-eval)?
>
> It would likely help with unasking the question of what to do when
> (current-module) is different at the time of local-eval. I don't know,
> however, what the _lexical_ effects of switching the current module are
> supposed to be. If it is supposed to be a noop, then lexical
> environments and modules are presumably orthogonal, and eval should
> likely be allowed to take both (currently, local-eval is like taking a
> lexical environment and using primitive-eval in it).
Would you not it work as though you inserted code in the place where then environment? - Then the syntactical rules should be captured as well.
In addition, there should be a way to communicate with the surrounding environment, wherefrom the code is inserted. The only truly safe way would be to make that explicit somehow, if not merely returning a value suffices.
Hans
next prev parent reply other threads:[~2011-12-16 14:57 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-12-15 10:21 summary: lilypond, lambda, and local-eval Andy Wingo
2011-12-15 14:46 ` David Kastrup
2011-12-15 16:52 ` Hans Aberg
2011-12-15 17:24 ` David Kastrup
2011-12-15 17:52 ` Hans Aberg
2011-12-16 7:35 ` Mark H Weaver
2011-12-16 8:08 ` Mark H Weaver
2011-12-16 8:49 ` Mark H Weaver
2011-12-16 9:16 ` David Kastrup
2011-12-18 7:11 ` Mark H Weaver
2011-12-18 11:27 ` Andy Wingo
2011-12-18 15:32 ` Noah Lavine
2011-12-18 16:19 ` David Kastrup
2011-12-18 21:24 ` Noah Lavine
2011-12-19 9:13 ` Mark H Weaver
2012-01-09 14:44 ` David Kastrup
2011-12-16 9:28 ` Andy Wingo
2011-12-16 9:59 ` David Kastrup
2011-12-16 10:33 ` Mark H Weaver
2011-12-16 12:13 ` Hans Aberg
2011-12-16 12:43 ` David Kastrup
2011-12-16 14:57 ` Hans Aberg [this message]
2011-12-21 10:32 ` Ian Hulin
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=D31F8B2A-FE08-4155-9F8A-097D8A15B76E@telia.com \
--to=haberg-1@telia.com \
--cc=dak@gnu.org \
--cc=guile-devel@gnu.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).