[racket] Compiling programs with embedded procedures
I am trying to understand how the expansion/compilation process deals
with embedding procedures in the syntax of a program, and I have now
constructed a program that returns different values when run in
drracket, and racket. It also does not compile for me using raco make.
I was wondering what people think the correct value it should produce
is, or if it is invalid as raco make would suggest.
The program:
#lang racket
(define-for-syntax foo 1)
(begin-for-syntax (set! foo 2))
(define-for-syntax get-foo (lambda ()
(begin0
foo
(set! foo (add1 foo)))))
(define-syntax (bar stx) (datum->syntax stx get-foo))
((bar))
drracket returns 2
racket returns 1
raco make says that it cannot marshal the procedure embedded in the
compiled code.
-Eric