[racket] Compiling programs with embedded procedures

From: Eric Dobson (endobson at cs.brown.edu)
Date: Sun Dec 26 17:31:23 EST 2010

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 ()
                               (set! foo (add1 foo)))))
(define-syntax (bar stx) (datum->syntax stx get-foo))


drracket returns 2
racket returns 1
raco make says that it cannot marshal the procedure embedded in the
compiled code.


Posted on the users mailing list.