Re: syntax-locally-bound-identifiers, local-eval

2012-01-25 Thread Andy Wingo
of the bound identifiers, for the record printer, we could. If at some point we decided that was a bad idea, we change the record printer, and ignore those new fields. That's the other thing: we are free to change the runtime, within the local-eval module, to do what we like. You won't ever get an old

Re: syntax-locally-bound-identifiers, local-eval

2012-01-23 Thread Andy Wingo
patches. I've manually removed the parts that patch psyntax-pp.scm, to not hurt our eyeballs :) From 68673f7507736f9a39d2d1eac9ef2a9ad1fd80dc Mon Sep 17 00:00:00 2001 From: Andy Wingo wi...@pobox.com Date: Sun, 15 Jan 2012 18:39:44 +0100 Subject: [PATCH 1/3] add syntax-locally-bound-identifiers

Re: syntax-locally-bound-identifiers, local-eval

2012-01-21 Thread Ludovic Courtès
...) (filter (lambda (x) (eq? (syntax-local-binding x) 'lexical)) (syntax-locally-bound-identifiers #'scope #'(list (cons 'id id) ...)) (let* ((x 10) (x 20)) (lexicals

Re: syntax-locally-bound-identifiers, local-eval

2012-01-21 Thread Mark H Weaver
Hi Andy, There's another thing that really should be fixed, for the sake of preserving our ability to change the implementation `local-eval' in the future. Since (the-environment) can be included in code compiled to disk, the lexical environment objects that it returns are effectively now

syntax-locally-bound-identifiers, local-eval

2012-01-20 Thread Andy Wingo
Hello, Here are a couple of patches. The first implements a new helper, syntax-locally-bound-identifiers, documented thusly: -- Scheme Procedure: syntax-locally-bound-identifiers id Return a list of identifiers that were visible lexically when the identifier ID was created, in order

Re: syntax-locally-bound-identifiers, local-eval

2012-01-20 Thread Andy Wingo
-bound-identifiers * module/ice-9/boot-9.scm (syntax-locally-bound-identifiers): Declare variable. * module/ice-9/psyntax.scm: Add locally-bound-identifiers helper, and define syntax-locally-bound-identifiers. * doc/ref/api-macros.texi: Document the new procedure. --- doc/ref/api-macros.texi

Re: syntax-locally-bound-identifiers, local-eval

2012-01-20 Thread Mark H Weaver
() + (analyze-identifiers +(syntax-locally-bound-identifiers #'scope))) + (lambda (capture formals wrappers patterns) + (define (wrap-expression x) + (let lp ((x x) (wrappers wrappers)) + (if (null? wrappers

Re: syntax-locally-bound-identifiers, local-eval

2012-01-20 Thread Mark H Weaver
There's another thing that really should be fixed, for the sake of preserving our ability to change the implementation `local-eval' in the future. Since (the-environment) can be included in code compiled to disk, the lexical environment objects that it returns are effectively now part of our ABI.

Re: local-eval on syntax-local-binding, bound-identifiers

2012-01-19 Thread Andy Wingo
On Tue 17 Jan 2012 00:27, Andy Wingo wi...@pobox.com writes: TBH I think this is the best thing we can do for local-eval. We preserve flexibility for local-eval, make other experiments possible, and the local-eval implementation is a bit more perspicacious, as the scoping is more lexical (in

Re: local-eval on syntax-local-binding, bound-identifiers

2012-01-17 Thread David Kastrup
Andy Wingo wi...@pobox.com writes: What if instead we implemented closure serialization somehow? Then we would handle procedural macros too, and bound-identifiers would still be sufficient. Maybe that idea is a little too crazy. Are we still talking about Scheme? The language with call

Re: bound identifiers

2012-01-17 Thread Stefan Israelsson Tampe
Yes! see attachement! /Stefan On Tue, Jan 17, 2012 at 12:30 AM, Andy Wingo wi...@pobox.com wrote: On Mon 16 Jan 2012 22:56, Stefan Israelsson Tampe stefan.ita...@gmail.com writes: As you see, it's just wild west to get the racket code working. :) Can you give a stripped-down test case

Re: local-eval on syntax-local-binding, bound-identifiers

2012-01-16 Thread Mark H Weaver
: they come from the code itself. They are input the macro, and as such need an anti-mark. The anti-mark will be stripped from the expansion when the transformer that called `bound-identifiers' returns. Does this mean that `bound-identifiers' will not function properly when used outside

Re: local-eval on syntax-local-binding, bound-identifiers

2012-01-16 Thread Mark H Weaver
. The anti-mark will be stripped from the expansion when the transformer that called `bound-identifiers' returns. Does this mean that `bound-identifiers' will not function properly when used outside of a macro? What about if it's used within a macro that was generated by another macro (or things

Re: bound identifiers

2012-01-16 Thread Andy Wingo
On Mon 16 Jan 2012 20:46, Stefan Israelsson Tampe stefan.ita...@gmail.com writes: why are these two not equal in the sense of bound-identifier=? #(syntax-object x ((top) #(ribcage () () ()) #(ribcage () () ()) #(ribcage #(x) #((m1104 top)) #(i1105))) (hygiene guile-user)) #(syntax-object x

Re: bound identifiers

2012-01-16 Thread Stefan Israelsson Tampe
In syntax parse the racket code stores syntax values inside structs and then transport them down the macro chain as argument to macros. Then when unpacking the struct they are compared with arguments of syntax values. I think that this is the reason. I tried to experiment with psyntax macro

Re: bound identifiers

2012-01-16 Thread Andy Wingo
On Mon 16 Jan 2012 22:28, Andy Wingo wi...@pobox.com writes: On Mon 16 Jan 2012 20:46, Stefan Israelsson Tampe stefan.ita...@gmail.com writes: why are these two not equal in the sense of bound-identifier=? But that's not the right question or answer. Can you should where these

Re: local-eval on syntax-local-binding, bound-identifiers

2012-01-16 Thread Andy Wingo
it is partially apt?) Now, specific commentary. How about something like (bound-identifiers #'here)? scheme@(guile-user) (bound-identifiers #'here) $5 = () scheme@(guile-user) (let ((x 10)) (bound-identifiers #'here)) $6 = (#(syntax-object x ((#f top) shift #(ribcage #(x) #((top)) #(i176

Re: bound identifiers

2012-01-16 Thread Andy Wingo
On Mon 16 Jan 2012 22:56, Stefan Israelsson Tampe stefan.ita...@gmail.com writes: As you see, it's just wild west to get the racket code working. :) Can you give a stripped-down test case for this particular behavior? That code is paged into my and Mark's minds right now :) Andy --

local-eval on syntax-local-binding, bound-identifiers

2012-01-15 Thread Andy Wingo
-check list? ls 'generate-temporaries) -- 1.7.8.3 From 2c3da44320019453115811af386febaa7eb241c3 Mon Sep 17 00:00:00 2001 From: Andy Wingo wi...@pobox.com Date: Sun, 15 Jan 2012 18:39:44 +0100 Subject: [PATCH 2/3] add bound-identifiers * module/ice-9/boot-9.scm (bound-identifiers): Declare variable

Re: local-eval on syntax-local-binding, bound-identifiers

2012-01-15 Thread Mark H Weaver
-identifiers * module/ice-9/boot-9.scm (bound-identifiers): Declare variable. * module/ice-9/psyntax.scm: Add all-bound-identifiers helper, and define bound-identifiers. The identifiers are anti-marked so that syntax transformers can introduce them, as-is. --- module/ice-9/boot-9.scm |1