[racket] rudimentary macro Q.

From: Matthew Butterick (mb at mbtype.com)
Date: Wed Feb 26 11:51:24 EST 2014

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

Posted on the users mailing list.