[racket] tutorial: exploring the boundaries of outer space

From: Brian Mastenbrook (brian at mastenbrook.net)
Date: Wed Apr 11 12:26:55 EDT 2012

On Apr 11, 2012, at 11:09 AM, Danny Yoo wrote:

>> This problem still remains in your newest version of `def', since as a user of `m' I still need to know that it uses `def' internally.
> Oh!  I thought I designed the revised outer so that it should be
> agnostic to how 'm' works.

Sorry about that! I confused myself with a toy test case while looking at it. I'll have to explore a little further to see how it works. This one still seems a little confusing to me:

(define-syntax m3
 (syntax-rules ()
   ((_ id val)
    (let ()
      (def (h id)
        (def (g id)
        (g id))
      (h 2)))))

(def (g x)
  (def (h x)
    (m3 x (outer x)))
  (h 5))

-> "compile: unbound identifier (and no #%top syntax transformer is bound) in: x"

By the way, this doesn't seem to work, since the body ends up in a `syntax' form:

(def (f x)
  (define-syntax m3
    (syntax-rules ()
      ((_ id body ...)
         (def (id x)
           (m2 (outer x)))
         body ...))))
  (m3 g (g 2)))

Brian Mastenbrook
brian at mastenbrook.net

Posted on the users mailing list.