Seems like this works well enough, where I approximate the 
rename-transformer rather than the syntax property.

(define-syntax (mb stx)
     (syntax-case stx ()
       [(_ . args) (with-syntax ([args (syntax-property #'args 'key 
'value)])
                     #'(other-module-begin . args))]))



On Tuesday, November 28, 2017 at 9:05:07 PM UTC-8, Jack Firth wrote:
>
> What about passing the configuration data to `other-module-begin` via 
> keyword arguments or tagged expressions in the body of the 
> `(other-module-begin ...)` expansion? Is there a particular reason `mb` and 
> `other-module-begin` need to communicate with syntax properties?
>
> On Tuesday, November 28, 2017 at 7:15:50 PM UTC-8, Matthew Butterick wrote:
>>
>> I'm making a #%module-begin macro, but I want to delegate it to an 
>> existing one. 
>>
>> OK, let's start with a rename transformer: 
>>
>> (provide (rename-out [mb #%module-begin])) 
>> (define-syntax mb (make-rename-transformer #'other-module-begin)) 
>> (define-syntax other-module-begin (λ (stx) #'foo)) 
>>
>> That works, but I also need to pass some extra data to 
>> `other-module-begin` that controls how it's configured during this 
>> delegation. 
>>
>> OK, let's add a syntax property. But wrapping the property around the 
>> transformer doesn't work, because a rename transformer is not `syntax?`: 
>>
>> (provide (rename-out [mb #%module-begin])) 
>> (define-syntax mb (syntax-property (make-rename-transformer 
>> #'other-module-begin) 'foo "bar")) 
>> (define-syntax other-module-begin (λ (stx) #'foo)) 
>>
>> ;; syntax-property: contract violation 
>>
>>
>> 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)) 
>>
>> (syntax-property #'mb 'foo) ; #f 
>>
>>
>> Other possibilities with equivalent effect?
>
>

-- 
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 [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to