[racket] rudimentary macro Q.

From: Matthias Felleisen (matthias at ccs.neu.edu)
Date: Wed Feb 26 13:22:09 EST 2014

That's precisely the behavior you want: 
 -- what's exported is the public name, which would usually check/do things before it calls private 
 -- while the unprotected private one is not provided and should not be visilble. 

How does the mechanics work? Well it delivers path names to these private identifier that in principle you can find too. So you can get around provided/not-provided but you don't want to 

-- Matthias






On Feb 26, 2014, at 11:51 AM, Matthew Butterick <mb at mbtype.com> wrote:

> In this example, why can syntax produced via macro reach the private function, while the ordinary syntax cannot?
> 
> 
> ;;;;;;;;;;;;;;;;;;;;;;;;
> ;; one.rkt
> #lang racket/base
> 
> (provide public-proc)
> 
> (define (private-proc x)
>  (format "The private proc says ~a" x))
> 
> (define-syntax-rule (public-proc x)
>  (private-proc x))
> ;;;;;;;;;;;;;;;;;;;;;;;;
> 
> ;;;;;;;;;;;;;;;;;;;;;;;;
> ;; two.rkt
> #lang racket/base
> (require "one.rkt")
> ;;;;;;;;;;;;;;;;;;;;;;;;
> 
> Running two.rkt:
>> (public-proc 'hi)
> "The private proc says hi"
>> (private-proc 'hi)
> private-proc: undefined
> ____________________
>  Racket Users list:
>  http://lists.racket-lang.org/users



Posted on the users mailing list.