[PATCH] local-eval, local-compile, and the-environment (v3)

2012-01-14 Thread Mark H Weaver
Hello all, Here's the third version of my simple `local-eval' patch. Notable changes from last time: * Pattern variables are now captured properly. * `the-environment' now works as advertised within macro definitions. * Added doc strings for `local-eval' and `local-compile'. I am open to reimple

Re: GNU Guile branch, master, updated. v2.1.0-102-g0f9f51a

2012-01-14 Thread Ludovic Courtès
Hello! Mark H Weaver skribis: > Andy Wingo writes: > >> On Wed 16 Nov 2011 04:58, Mark H Weaver writes: >> >>> I think there are better ways to address this problem. I will explore >>> these in another email. >> >> I look forward to this. Please be sure to address the following issues: >> >>

Re: GNU Guile branch, master, updated. v2.1.0-102-g0f9f51a

2012-01-14 Thread dsmich
Mark H Weaver wrote: > There's another option: we could properly track the compile-time > dependencies of each module, and automatically consider a .go file stale > if _any_ of its compile-time dependencies are newer than it. > > To be more specific: I think we need to record, in every syn

Re: add-relative-load-path ?

2012-01-14 Thread Neil Jerram
Andy Wingo writes: > Then in your script you would (add-relative-load-path "."). > > Maybe we need an `add-to-load-path' form that handles the eval-when, > actually, so it would be > > (add-to-load-path (dirname (current-source-filename))) > > or something like that. (We'd have to define curre

Re: GNU Guile branch, master, updated. v2.1.0-102-g0f9f51a

2012-01-14 Thread Mark H Weaver
David Kastrup writes: > Mark H Weaver writes: > >> Furthermore, we could provide distros with the necessary >> infrastructure to automatically recompile guile modules as needed >> after package upgrades. >> >> I know of at least one precedent for this behavior: the emacs packages >> in Debian.

Re: GNU Guile branch, master, updated. v2.1.0-102-g0f9f51a

2012-01-14 Thread David Kastrup
Mark H Weaver writes: > Furthermore, we could provide distros with the necessary > infrastructure to automatically recompile guile modules as needed > after package upgrades. > > I know of at least one precedent for this behavior: the emacs packages > in Debian. Last I checked, Debian had an ela

Re: GNU Guile branch, master, updated. v2.1.0-102-g0f9f51a

2012-01-14 Thread Mark H Weaver
Andy Wingo writes: > On Wed 16 Nov 2011 04:58, Mark H Weaver writes: > >> I think there are better ways to address this problem. I will explore >> these in another email. > > I look forward to this. Please be sure to address the following issues: > > * Debian upgrading guile to a newer versi

Re: A plea for local-eval in 2.0.4

2012-01-14 Thread Mark H Weaver
David Kastrup writes: > Mark H Weaver writes: > >> Indeed, (local-eval '(set! x 5) ) is _not_ equivalent to >> (module-set! (current-module) 'x 5). > > To clarify: I was thinking about > > (local-eval '(set! x 5) ) vs > (local-eval '(module-set! (current-module) 'x 5) ) Unless `module-set!' or

Re: A plea for local-eval in 2.0.4

2012-01-14 Thread David Kastrup
David Kastrup writes: > Mark H Weaver writes: > >> Indeed, (local-eval '(set! x 5) ) is _not_ equivalent to >> (module-set! (current-module) 'x 5). > > To clarify: I was thinking about > > (local-eval '(set! x 5) ) vs > (local-eval '(module-set! (current-module) 'x 5) ) > >> Assuming that `x' is

Re: A plea for local-eval in 2.0.4

2012-01-14 Thread David Kastrup
Mark H Weaver writes: > Indeed, (local-eval '(set! x 5) ) is _not_ equivalent to > (module-set! (current-module) 'x 5). To clarify: I was thinking about (local-eval '(set! x 5) ) vs (local-eval '(module-set! (current-module) 'x 5) ) > Assuming that `x' is not locally bound within the captured

Re: A plea for local-eval in 2.0.4

2012-01-14 Thread Mark H Weaver
> David Kastrup writes: >> within local-eval, what is the return value of calling >> (current-module)? I would expect that it is the same as outside of >> local-eval I wrote: > Actually, this is not true. Within `local-eval', (current-module) is > temporarily restored (using dynamic-wind) to th

Re: A plea for local-eval in 2.0.4

2012-01-14 Thread David Kastrup
Mark H Weaver writes: > David Kastrup writes: >> within local-eval, what is the return value of calling >> (current-module)? I would expect that it is the same as outside of >> local-eval > > Actually, this is not true. Within `local-eval', (current-module) is > temporarily restored (using dyn

Re: syntax-local-value patch for discussion

2012-01-14 Thread Stefan Israelsson Tampe
Ok, I have tried follow your suggestion, here is what I could make, (with-fluids ((*macro-lookup* (lambda (e) (cond ((number? e) (pk w)) ((symbol? e)

Re: [PATCH] Implement local-eval, local-compile, and the-environment

2012-01-14 Thread Andy Wingo
Hi Mark, On Sun 08 Jan 2012 21:39, Mark H Weaver writes: Are there some short primitives that psyntax could export that would make it possible to implement `the-environment' in a module? > >>> * The list of ordinary variables (these need to be boxed) >>> * The list of simulated variabl

Re: A plea for local-eval in 2.0.4

2012-01-14 Thread Mark H Weaver
David Kastrup writes: > within local-eval, what is the return value of calling > (current-module)? I would expect that it is the same as outside of > local-eval Actually, this is not true. Within `local-eval', (current-module) is temporarily restored (using dynamic-wind) to the module saved in

Re: [PATCH] Implement local-eval, local-compile, and the-environment

2012-01-14 Thread Andy Wingo
Hi Mark, On Sun 08 Jan 2012 21:39, Mark H Weaver writes: > Andy Wingo writes: >> I guess it's not clear to me why you would want to force expression >> context. > > If we allow definitions, then your nice equivalence > >== (local-eval ' (the-environment)) > > no longer holds. Also, the use

Re: Variables and the evaluator

2012-01-14 Thread Andy Wingo
Hi, Sorry, forgot to respond to another bit on this subtopic: On Sat 14 Jan 2012 16:28, Andy Wingo writes: > On Sun 08 Jan 2012 21:39, Mark H Weaver writes: > > >> More importantly, is there any guarantee that mutable lexicals will > >> continue to be represented as variable objects in future

Re: A plea for local-eval in 2.0.4

2012-01-14 Thread Andy Wingo
On Sat 14 Jan 2012 16:16, David Kastrup writes: > Andy Wingo writes: > >> On Sat 14 Jan 2012 09:59, David Kastrup writes: >> >>> so that (define x 5) inside of local-eval would _not_ be equivalent to >>> (module-define! (current-module) 'x 5) as the first one would take the >>> current module a

Variables and the evaluator (Was: [PATCH] Implement local-eval, local-compile, and the-environment)

2012-01-14 Thread Andy Wingo
Hi Mark, On Sun 08 Jan 2012 21:39, Mark H Weaver writes: > Andy Wingo writes: >>> We could change that, but I'm reluctant to make the evaluator any >>> slower than it already is. >> >> Using variable objects has the possibility to make the evaluator faster, >> actually, if at the same time we m

Re: A plea for local-eval in 2.0.4

2012-01-14 Thread Andy Wingo
Hi Mark, Thanks again for working on local-eval. I didn't like it at first, but you did an admirable job handling all of the semantic, implementation, and social nitty-gritties in order to solve the problem nicely. Excellent! If it is the case that it gets in for 2.0.4, then great. We should tr

Re: A plea for local-eval in 2.0.4

2012-01-14 Thread David Kastrup
Andy Wingo writes: > On Sat 14 Jan 2012 09:59, David Kastrup writes: > >> so that (define x 5) inside of local-eval would _not_ be equivalent to >> (module-define! (current-module) 'x 5) as the first one would take the >> current module at the-environment time, and the second one would take >> i

Re: Cheap list?

2012-01-14 Thread Andy Wingo
On Sat 14 Jan 2012 10:15, David Kastrup writes: > Is there any recommended way to do the equivalent of (or (pair? x) > (null? x))? Not currently, no. (Interesting predicate, btw.) Andy -- http://wingolog.org/

Re: A plea for local-eval in 2.0.4

2012-01-14 Thread Andy Wingo
On Sat 14 Jan 2012 09:59, David Kastrup writes: > In Guilev1, the module is probably recorded as part of the > procedure-environment. In Guilev2, a variable reference is compiled? > How does that work when there is no such variable? It gets created > with an undefined binding? Guile 2.0.x reco

Cheap list? (was: [PATCH] Fix serialization of #nil-terminated lists during compilation)

2012-01-14 Thread David Kastrup
Mark H Weaver writes: > FYI, bipt mentioned this bug on IRC: > > (compile '(cdr '(5 . #nil)) #:to 'value) => () > (cdr '(5 . #nil)) => #nil > > and I pushed the attached fix to stable-2.0. Oh, by the way: the Lisp predicate listp (at least Elisp) is listp is a built-in function in `C source cod

Re: A plea for local-eval in 2.0.4

2012-01-14 Thread David Kastrup
Mark H Weaver writes: > Probably the easiest way to think about it is that (the-environment) > acts like (list (lambda () ) ...), with one `lambda' for each > expression that you will later pass to `local-eval'. Calling > `local-eval' simply calls the appropriate procedure in that list. Well, I

[PATCH] Fix serialization of #nil-terminated lists during compilation

2012-01-14 Thread Mark H Weaver
FYI, bipt mentioned this bug on IRC: (compile '(cdr '(5 . #nil)) #:to 'value) => () (cdr '(5 . #nil)) => #nil and I pushed the attached fix to