(load "~~/syntax-case")
;; alias so compiler can inline for speed (define-syntax INSTANCE-DISPATCHER (syntax-rules () ((instance-dispatcher inst) (cdr inst))))
invoke gsi and then enter (load "oop.scm") I get a "Ill-formed expression" error. I don't really understand why these two methods produce very different results. Obviously, I am missing something but I have yet to find out what. Any help is appreciated.
This doesn't work because the (load "~~/syntax-case") is executed **after** macro expansion. Gambit uses a "classic" compilation model separated in phases:
1) read the source code (using the reader, i.e. "read") 2) expand macros and convert source code to an AST 3) transform AST (inlining, constant folding, etc) 4) compile AST to intermediate form, etc 5) execute code
As you see the "load" is executed in phase 5, which is after macros have been expanded in phase 2. The system thinks define-syntax is a function you are trying to call, and () is one of its arguments (which is an invalid expression in Scheme).
Replace the (load "~~/syntax-case") by (include "~~/syntax-case.scm") and your code should work (because "include" is handled in phase 2).
Marc