[plt-scheme] Using syntax before define-syntax is weird

From: Neil Toronto (ntoronto at cs.byu.edu)
Date: Thu Apr 8 00:16:22 EDT 2010

DrScheme 4.2.5. This:

(define-syntax (bob stx)
   (syntax-case stx ()
     [(_)  #'3]
     [_  #'4]))

(bob)


outputs 3 as it should. This:

(bob)

(define-syntax (bob stx)
   (syntax-case stx ()
     [(_)  #'3]
     [_  #'4]))


results in "procedure application: expected procedure, given: 4 (no 
arguments)" The macro stepper verifies that (bob) is getting expanded to 
(4). IOW, the expander never passes #'(bob) to "bob".

Is this intended behavior?

Neil T



Posted on the users mailing list.