This is the mail archive of the kawa@sourceware.org mailing list for the Kawa project.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Other format: | [Raw text] |
I encountered a similar problem, where something works in the REPL but fails during compilation, attempting to use:
(define-syntax (import-class fqcn) (syntax-case fqcn () ((import-class fqcn) (let* ((cls :: java.lang.Class (eval (syntax fqcn))) (name :: string (java.lang.Class:getSimpleName cls))) #`(define-alias ,name ,cls)))))
which is intended to approximate the effect of a Java import. ... During compilation, even if the define-syntax comes before any usage in the file: [kawa] java.lang.NullPointerException [kawa] at gnu.expr.ReferenceExp.apply(ReferenceExp.java:155)
This was a bug in "eval" of weird scopes (such as happen when dealing with macros). (Not the eval in the macro - the eval done by the compiler to expand the syntax-case.)
(define-syntax (import-class form) (syntax-case form () ((import-class fqcn) (let* ((cls :: java.lang.Class (eval (syntax fqcn))) (name (string->symbol (java.lang.Class:getSimpleName cls)))) #`(define-alias ,(datum->syntax-object form name) fqcn))))) -- --Per Bothner per@bothner.com http://per.bothner.com/
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |