Re: [PATCH] Implement `the-environment' and `local-eval' in evaluator

2012-01-07 Thread Mark H Weaver
Andy Wingo writes: > Here's the thing, I think: FOO and (local-eval FOO (the-environment)) > should be equivalent. Agreed. This is the equivalence that we should strive to achieve. My simple patch honors this equivalence for the bindings that it supports (which unfortunately does not yet includ

Re: [PATCH] Implement `the-environment' and `local-eval' in evaluator

2012-01-06 Thread Andy Wingo
On Fri 16 Dec 2011 20:12, Mark H Weaver writes: > So, in cases where (the-environment) is found within a macro template, > I guess I'm still undecided about whether the captured expander > environment should be at the point of (the-environment), or whether it > should be at the point of the initi

Re: [PATCH] Implement `the-environment' and `local-eval' in evaluator

2012-01-06 Thread Andy Wingo
On Fri 16 Dec 2011 18:44, Mark H Weaver writes: > Andy Wingo writes: >>> (define foo 'module-a) >>> (define-syntax alt-environment >>> (syntax-rules () >>> ((_) (the-environment >> >>> and then evaluate the following within module B: >> >>> (define foo 'module-b) >>> (local-eval 'foo (

Re: [PATCH] Implement `the-environment' and `local-eval' in evaluator

2011-12-16 Thread Mark H Weaver
I wrote: > Having thought more about this, I'm fully convinced that 'module-a > should be the answer. On second thought, I don't think my argument was very solid. My nephew demanded my attention while I was working on that email, and so I rushed it out when I should have put it aside and pondered

Re: [PATCH] Implement `the-environment' and `local-eval' in evaluator

2011-12-16 Thread Mark H Weaver
Andy Wingo writes: >> (define foo 'module-a) >> (define-syntax alt-environment >> (syntax-rules () >> ((_) (the-environment > >> and then evaluate the following within module B: > >> (define foo 'module-b) >> (local-eval 'foo (alt-environment)) > >> What should the result be? > >> My gue

Re: [PATCH] Implement `the-environment' and `local-eval' in evaluator

2011-12-16 Thread Hans Aberg
On 16 Dec 2011, at 16:27, Mark H Weaver wrote: > As an interesting case, suppose that you define the following macro in > module A: > > (define foo 'module-a) > (define-syntax alt-environment > (syntax-rules () >((_) (the-environment > > and then evaluate the following within module B:

Re: [PATCH] Implement `the-environment' and `local-eval' in evaluator

2011-12-16 Thread Andy Wingo
On Fri 16 Dec 2011 16:27, Mark H Weaver writes: > To my mind, top-level (module) variables are conceptually part of every > lexical environment placed within that module. Agreed. > (define foo 'module-a) > (define-syntax alt-environment > (syntax-rules () > ((_) (the-environment > an

Re: [PATCH] Implement `the-environment' and `local-eval' in evaluator

2011-12-16 Thread Mark H Weaver
Peter TB Brett writes: > David Kastrup writes: > >>> * I still wouldn't be surprised if `local-eval' does the wrong thing if >>> (current-module) is different from what it was when the associated >>> `primitive-eval' was called. >> >> Before anyone even _defines_ what the "right thing" would

Re: [PATCH] Implement `the-environment' and `local-eval' in evaluator

2011-12-16 Thread David Kastrup
Peter TB Brett writes: > David Kastrup writes: > >>> * I still wouldn't be surprised if `local-eval' does the wrong thing if >>> (current-module) is different from what it was when the associated >>> `primitive-eval' was called. >> >> Before anyone even _defines_ what the "right thing" would

Re: [PATCH] Implement `the-environment' and `local-eval' in evaluator

2011-12-16 Thread Peter TB Brett
David Kastrup writes: >> * I still wouldn't be surprised if `local-eval' does the wrong thing if >> (current-module) is different from what it was when the associated >> `primitive-eval' was called. > > Before anyone even _defines_ what the "right thing" would be, there is > little point in

Re: [PATCH] Implement `the-environment' and `local-eval' in evaluator

2011-12-16 Thread David Kastrup
Mark H Weaver writes: > Here's an improved version of the preliminary evaluator-only > implementation of `the-environment' and `local-eval'. I renamed the > primitives to the Guile 1.8 names, fixed the expansion within > `local-eval' to use `expand' instead of `expand-top-sequence', made the > m

[PATCH] Implement `the-environment' and `local-eval' in evaluator

2011-12-16 Thread Mark H Weaver
= 3 scheme@(guile-user)> (local-eval '(set! x (+ x 10)) env2) $8 = 11 scheme@(guile-user)> (local-eval 'x env1) $9 = 1 Mark >From c6748349a833cd61b380259ca8b9d81d7f14128f Mon Sep 17 00:00:00 2001 From: Mark H Weaver Date: Wed, 14 Dec 2011 03:12:43 -0500 Subject: [PATCH] Implement