Re: [racket-users] how can I approximate syntax properties with `make-rename-transformer`?

2017-11-30 Thread 'William J. Bowman' via Racket Users
Also, I don't seem to have recorded this anywhere, but I recall that setting
the syntax-property 'not-free-identifier=? helped with this or a related
problem regarding syntax-properties across module boundaries.
  
https://docs.racket-lang.org/reference/stxtrans.html#%28def._%28%28quote._~23~25kernel%29._make-rename-transformer%29%29

On Thu, Nov 30, 2017 at 11:21:12AM +0100, 'William J. Bowman' via Racket Users 
wrote:
> > I can wrap the property around the target identifier, but the syntax 
> > property doesn't stick:
> > 
> > (provide (rename-out [mb #%module-begin]))
> > (define-syntax mb (make-rename-transformer (syntax-property 
> > #'other-module-begin 'foo "bar")))
> > (define-syntax other-module-begin (λ (stx) #'foo))
> We've seen this problem before.
> It has to do with module boundaries and how syntax properties are preserved.
>   https://groups.google.com/d/msg/racket-users/ZWjpz3kFmjo/SUXGVM3YEAAJ
> 
> It's been a while since I wrote this, but the work around I used was 
> exporting the identifier that *expanded into code* that inserted the syntax 
> property.
> This way, ths property doesn't need to be preserve, since it gets inserted 
> every time it is used:
> > The workaround seems to be: if you want to stash an identifier in a 
> > syntax-property, expand into syntax that attaches the syntax-property. That 
> > is, don't do (define x (syntax-property #'id 'prop #'stx)) and then use x 
> > in a syntax object, but generate #`(... (syntax-property #'id 'prop #'stx 
> > ...)) 
> 
> --
> William J. Bowman
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Racket Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to racket-users+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] how can I approximate syntax properties with `make-rename-transformer`?

2017-11-30 Thread 'William J. Bowman' via Racket Users
> I can wrap the property around the target identifier, but the syntax property 
> doesn't stick:
> 
> (provide (rename-out [mb #%module-begin]))
> (define-syntax mb (make-rename-transformer (syntax-property 
> #'other-module-begin 'foo "bar")))
> (define-syntax other-module-begin (λ (stx) #'foo))
We've seen this problem before.
It has to do with module boundaries and how syntax properties are preserved.
  https://groups.google.com/d/msg/racket-users/ZWjpz3kFmjo/SUXGVM3YEAAJ

It's been a while since I wrote this, but the work around I used was exporting 
the identifier that *expanded into code* that inserted the syntax property.
This way, ths property doesn't need to be preserve, since it gets inserted 
every time it is used:
> The workaround seems to be: if you want to stash an identifier in a 
> syntax-property, expand into syntax that attaches the syntax-property. That 
> is, don't do (define x (syntax-property #'id 'prop #'stx)) and then use x in 
> a syntax object, but generate #`(... (syntax-property #'id 'prop #'stx ...)) 

--
William J. Bowman

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.