Re: [racket-dev] some surprising behavior with syntax-parameterize and lexical info

2012-04-09 Thread Danny Yoo
> Ah ha!  So that's where my mental model is diverging from reality. > Thank you.  For some reason, I had been thinking that the > transformer-time expression in the syntax-parameterize was somehow > impervious to the lexical enrichment process. Here's the first draft of a small tutorial on the p

Re: [racket-dev] some surprising behavior with syntax-parameterize and lexical info

2012-04-06 Thread Danny Yoo
> > At the time 'def' is expanded, the lexical context of 'function-stx' does > not include the bindings of 'args'. But then the macro produces an > expression with that term inside a 'quote-syntax' form that is inside the > scope of the 'args'. So by the time the expander gets to the 'quote-syntax

Re: [racket-dev] some surprising behavior with syntax-parameterize and lexical info

2012-04-06 Thread Ryan Culpepper
On 04/06/2012 12:47 PM, Danny Yoo wrote: I suspect that I should be using quote-syntax at this specific point, but I am not completely sure. Right. Try replacing ??? with (quote-syntax #,a-placeholder). I have to admit that I'm still confused. Here's my example: ;;;

Re: [racket-dev] some surprising behavior with syntax-parameterize and lexical info

2012-04-06 Thread Danny Yoo
> (define-syntax (def stx) >  (syntax-case stx () >   [(_ (name args ...) body ...) >    (with-syntax ([function-stx stx]) >      (syntax/loc stx >        (define (name args ...) >          (splicing-syntax-parameterize ([current-def >                                          (quote-syntax fuunctio

Re: [racket-dev] some surprising behavior with syntax-parameterize and lexical info

2012-04-06 Thread Danny Yoo
On Fri, Apr 6, 2012 at 4:13 PM, Michael W wrote: > This seems to work for me, printing 84, just like you expect: > > ; > > (define-syntax (def stx) >  (syntax-case stx () >   [(_ (name args ...) body ...) >    (with-syntax ([function-

Re: [racket-dev] some surprising behavior with syntax-parameterize and lexical info

2012-04-06 Thread Michael W
This seems to work for me, printing 84, just like you expect: ; (define-syntax (def stx) (syntax-case stx () [(_ (name args ...) body ...) (with-syntax ([function-stx stx]) (syntax/loc stx (define (name args ...

Re: [racket-dev] some surprising behavior with syntax-parameterize and lexical info

2012-04-06 Thread Danny Yoo
>> I suspect that I should be using quote-syntax at this specific point, >> but I am not completely sure. > > Right. Try replacing ??? with (quote-syntax #,a-placeholder). I have to admit that I'm still confused. Here's my example: ;;;

Re: [racket-dev] some surprising behavior with syntax-parameterize and lexical info

2012-04-05 Thread Ryan Culpepper
On 04/05/2012 08:31 PM, Danny Yoo wrote: If that doesn't seem clear, can you explain more your line of reasoning that they should be the same? I guess I'm having a hard time with this: I want to get the value of a-placeholder into the place marked ??? in the following: ;;;

Re: [racket-dev] some surprising behavior with syntax-parameterize and lexical info

2012-04-05 Thread Danny Yoo
> If that doesn't seem clear, can you explain more your line of reasoning > that they should be the same? I guess I'm having a hard time with this: I want to get the value of a-placeholder into the place marked ??? in the following: ;;;

Re: [racket-dev] some surprising behavior with syntax-parameterize and lexical info

2012-04-05 Thread Matthew Flatt
At Thu, 05 Apr 2012 17:34:54 -0600, Michael W wrote: > Hey wow, maybe I might understand this. Or maybe I might be > totally wrong. Here's a guess: > > In the first version, the (splicing-syntax-parameterize) takes > effect *when f is defined*; [...] > > But in the second version, the splicing-sy

Re: [racket-dev] some surprising behavior with syntax-parameterize and lexical info

2012-04-05 Thread Michael W
Hey wow, maybe I might understand this. Or maybe I might be totally wrong. Here's a guess: In the first version, the (splicing-syntax-parameterize) takes effect *when f is defined*; then, after the definition, the parameter is reset to #f (and presumably it's lexical binding) because it's a parame

[racket-dev] some surprising behavior with syntax-parameterize and lexical info

2012-04-05 Thread Danny Yoo
I'm hitting some behavior I don't understand: here's code to demonstrate: ;; #lang racket (require racket/stxparam racket/splicing) (define-syntax-parameter current-def #f) (define-syntax (def stx) (syntax-case stx ()