[racket] Exposition via macro

From: Vincent St-Amour (stamourv at ccs.neu.edu)
Date: Fri Jan 4 15:21:39 EST 2013

If the original and user code are in different modules, you can use
`provide' with `rename-out' or `require' with `rename-in'.

Vincent


At Fri, 04 Jan 2013 20:52:36 +0100,
Philipp Dikmann wrote:
> 
> Hello everybody,
> 
> I'm trying to expose a module's functionality to the user via a macro 
> that will let them use 'short-hand' names for the provided functions. 
> Yet I want to keep the 'long' names inside the original code for 
> clarity. The code below will not work - because of macro hygiene - but 
> demonstrates the intention. How would you approach this?
> 
> #lang racket
> 
> (provide with-timesten)
> 
> (define (timesten x)
>    (* x 10))
> 
> (define-syntax with-timesten
>    (syntax-rules ()
>      [(_ body ...) (let ([tt timesten])
>                      (begin
>                        body ...))]))
> 
> ;; ... so the user can do:
> (with-timesten
>   (tt 1)
>   (tt 2)
>   (tt 3))
> 
> Best regards,
> Philipp
> 
> ____________________
>   Racket Users list:
>   http://lists.racket-lang.org/users

Posted on the users mailing list.