[racket] Using make-provide-transformer

From: Matthew Flatt (mflatt at cs.utah.edu)
Date: Sun Nov 25 08:42:43 EST 2012

The part about using `syntax-local-lift-expression' is for provide
*pre-*transformers. (Yes, I know...)

Here's an example:

 #lang racket
 (require (for-syntax racket/provide-transform))

 (define-syntax one-two-three
   (make-provide-pre-transformer
    (lambda (stx modes)
      #`(rename-out [#,(syntax-local-lift-expression #'1) one]
                    [#,(syntax-local-lift-expression #'2) two]
                    [#,(syntax-local-lift-expression #'3) three]))))

 (provide (one-two-three))


At Fri, 23 Nov 2012 21:55:05 +0100, "Sam Vervaeck" wrote:
> Hi,
> 
>  
> 
> I have a question relating to syntax-transformers.
> 
>  
> 
> I'm trying to implement my own provide-syntax using
> make-provide-transformer. The documentation says that it should be possible
> to use syntax-local-lift-expression to dynamically insert new variables into
> the module and then export them (see link below), but I really don't seem to
> get it working. A somewhat trivial example:
> 
>  
> 
> (define-syntax one-two-three
> 
>   (make-provide-transformer
> 
>     (lambda (stx modes)
> 
>       (list (make-export (syntax-lift-expression #'1) 'one #f #f stx)
> 
>               (make-export (syntax-lift-expression #'2) 'two #f #f stx) 
> 
>               (make-export (syntax-lift-expression #'3) 'three #f #f
> stx)))))
> 
>  
> 
> (povide (one-two-three))
> 
>  
> 
> Could you by any chance provide me with an example of how the two procedures
> can be used to achieve this?
> 
>  
> 
> Greetings,
> 
>  
> 
> Sam
> 
> PS: I'm referring to paragraph two of
> http://docs.racket-lang.org/reference/stxtrans.html#(tech._provide._transfor
> mer) 
> 
> ____________________
>   Racket Users list:
>   http://lists.racket-lang.org/users

Posted on the users mailing list.