It would be nice to have expand work on stuff like
Code: Select all
(setq a 'r)
(expand (a:a b) 'a ) => (r:r b)
Code: Select all
(define-macro (def-mac _dm _body)
(let (_s (string _dm))
(eval-string
(format "(context '%s) (define-macro (%s:%s) %s) (context 'MAIN)"
_s
_s
_s
(string (eval _body)))))
Code: Select all
(context 'my-setq)
(define-macro (my-setq:my-setq x y) (set x (eval y)))
(context MAIN)
Code: Select all
(def-mac (my-setq x y) (set x (eval y)))
Note this is almost static scoping for macros (the variables within the context remain after the macro call). If context variables where deleted on leaving the call we would have static scoping. I wonder if contexts could be used to form a contiunation? Is it possible to make define-macro statically scoped in newLISP?
Eddie