Below is a short example showing that identifier-binding doesn't seem to 
work quite right with Scribble's make-base-eval. It works fine with 
make-evaluator from racket/sandbox.

I'm not sure why this is, but using syntax-local-value instead works 
everywhere. (Implementation here:

#lang racket
(require scribble/eval

(define (setup eval)
   '(define-syntax (define-if-not stx)
      (syntax-case stx ()
        [(_ id val)
         (identifier-binding #'id)
        [(_ id val)
         #'(define id val)]))))

(define scribble-eval (make-base-eval))
(scribble-eval '(require racket))
(setup scribble-eval)

(define racket-eval (make-evaluator 'racket))
(setup racket-eval)

(scribble-eval '(define-if-not foo 1))
(scribble-eval '(define-if-not foo 2))
(scribble-eval 'foo) ; want 1, get 2

(racket-eval '(define-if-not bar 3))
(racket-eval '(define-if-not bar 4))
(racket-eval 'bar) ; want 3, get 3

You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
For more options, visit

Reply via email to