Why is "swindle" different in the racket interpreter than in drracket?

Viewed 87

Can someone explain the difference between using drracket with swindle (any of the versions) and firing up the interpreter as: racket -I swindle

Many expressions evaluate the same in both environments, but some don't. For example:

(let-syntax ((let* (syntax-rules () ((let* a b) "You used let*")))) (let* 3 4))

... evaluates to "You used let*" in every scheme-based language I tried in drracket. However, it fails in the interpreter brought up by "racket -I swindle" on the command line with the error

; readline-input:1:20: syntax-rules: unbound identifier; ; also, no #%app syntax transformer is bound in the transformer phase ; at: syntax-rules ; in: (syntax-rules () ((let* a b) "You used let*")) ; [,bt for context]

1 Answers

Your example uses syntax-rules at phase 1 (aka the "for-syntax phase", aka the "transformer phase"), but it appears that the swindle module (unlike racket/base and racket) does not provide any bindings for-syntax. (It looks like swindle uses an old technique to provide phase-1 bindings that works for modules written in the swindle language but not for a REPL started with racket -l swindle.)

One workaround is to evaluate

(require (for-syntax racket/base))

before evaluating your example, and then your example should work as you expect.

Related