[gambit-list] Compiling "post-reader" forms?

Nathan Sorenson nathan.d.sorenson at gmail.com
Sun Jun 2 04:02:59 EDT 2013


>
> I don't think so because the interpreter and compiler unwrap symbols when
> checking if they refer to macros.  Do you have an example where this is not
> happening?
>

This demonstrates the problem I'm having in using a macro to attach source
info to symbols that name macros:

;OK
(eval `(#(,##source2-marker lambda "foo" 1) () 'hi))

;Also OK
(eval `(,(source-at "foo" 1 2 'lambda) () 'hi))

;fails
(eval '((source-at "foo" 1 2 lambda) () 'hi))
*** ERROR IN "foo.cljscm"@1.2 -- Macro name can't be used as a variable:
lambda

;likewise when compiling:
;;;; fail.scm ;;;;;;
(define fail ((source-at "foo" 1 2 lambda) () 'hi))

 $ gsc -debug fail.scm
*** ERROR IN "/tmp/foo"@1.2 -- Macro name can't be used as a variable:
lambda

I think the unquote in the two OK examples suggests that some kind of
pre-macro-expansion evaluation stage is needed for attaching source
information to symbols that refer to macros.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.iro.umontreal.ca/pipermail/gambit-list/attachments/20130602/9006c850/attachment.htm>


More information about the Gambit-list mailing list