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

2012-01-25 Thread Andy Wingo
e would be adding a field to the record. The embedded make-struct calls from the expansion would result in a record with the new number of fields, but with #f for the new fields. This is actually a quite powerful capability. For example if we wanted to add a field to list the names of the bound i

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

2012-01-23 Thread Andy Wingo
atches. 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 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 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

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 'i

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: syntax-locally-bound-identifiers, local-eval

2012-01-20 Thread Mark H Weaver
e) > + (call-with-values (lambda () > + (analyze-identifiers > + (syntax-locally-bound-identifiers #'scope))) > + (lambda (capture formals wrappers patterns) > + (define (wrap-expression x) > + (let lp ((x

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

2012-01-20 Thread Andy Wingo
On Fri 20 Jan 2012 13:33, Andy Wingo writes: > Here are a couple of patches. Aaaand, the patches: >From f549f273139bda9591194766157bb771a67d9563 Mon Sep 17 00:00:00 2001 From: Andy Wingo Date: Sun, 15 Jan 2012 18:39:44 +0100 Subject: [PATCH 1/2] add syntax-locally-bound-identifiers *

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: local-eval on syntax-local-binding, bound-identifiers

2012-01-19 Thread Andy Wingo
On Tue 17 Jan 2012 00:27, Andy Wingo 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 the same fi

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 wrote: > On Mon 16 Jan 2012 22:56, Stefan Israelsson Tampe > 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?

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

2012-01-17 Thread David Kastrup
Andy Wingo 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 ca

Re: bound identifiers

2012-01-16 Thread Andy Wingo
On Mon 16 Jan 2012 22:56, Stefan Israelsson Tampe 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 -- http://wingolog.org/

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

2012-01-16 Thread Andy Wingo
tching it a bit, but perhaps 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 ((#

Re: bound identifiers

2012-01-16 Thread Andy Wingo
On Mon 16 Jan 2012 22:28, Andy Wingo writes: > On Mon 16 Jan 2012 20:46, Stefan Israelsson Tampe > 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 > identifiers come from? Sorry, I've been

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 expande

Re: bound identifiers

2012-01-16 Thread Andy Wingo
On Mon 16 Jan 2012 20:46, Stefan Israelsson Tampe 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 ((#f top) shift

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

2012-01-16 Thread Mark H Weaver
;> identifiers: 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

bound identifiers

2012-01-16 Thread Stefan Israelsson Tampe
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 ((#f top) shift #(ribcage () () ()) #(ribcage #(x) #((m1104 top)) #("i1105"))) (hygiene

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

2012-01-16 Thread Andy Wingo
identifiers, and to >> capture some subset of them. It will do so by introducing references to >> them in the expansion of some macro. However they are not introduced >> identifiers: they come from the code itself. They are input the macro, >> and as such need an anti-mark. >&

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

2012-01-16 Thread Mark H Weaver
ansion of some macro. However they are not introduced > identifiers: 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

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

2012-01-16 Thread Andy Wingo
hem. It will do so by introducing references to them in the expansion of some macro. However they are not introduced identifiers: 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 calle

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

2012-01-15 Thread Mark H Weaver
Mark [... skipped the first patch, which looks very well implemented, though I'm still not sure that we should be exposing this in our API ...] > From 2c3da44320019453115811af386febaa7eb241c3 Mon Sep 17 00:00:00 2001 > From: Andy Wingo > Date: Sun, 15 Jan 2012 18:39:44 +0100

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

2012-01-15 Thread Andy Wingo
isplaced-lexical #f + (set! generate-temporaries (lambda (ls) (arg-check list? ls 'generate-temporaries) -- 1.7.8.3 >From 2c3da44320019453115811af386febaa7eb241c3 Mon Sep 17 00:00:00 2001 From: Andy Wingo Date: Sun, 15 Jan 2012 18:39:44 +0100 Subject: [PA