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]

Re: Using <java.lang.Class>:forName with define-simple-class


On 05/07/2010 01:31 AM, alex mitchell wrote:
I'm trying to get a kawa-based application to be aware of MacOS application
events such as Apple-Q, and would like to avoid having to change my source
code when compiling on other platforms.

I think a good way to handle this would be to extend cond-expand.


Probably in a way so that it can evaluate syntax-transformers, like:

(define-simple-class <foo> ((cond-expand ((is-mac) ....) (else #|none|#)) ) ...)

where is-mac is a syntax-case macro, which checks
(java.lang.System:getProperty "os.version")
at macro-expansion time.

There may also be some work needed so that define-simple-class
macro-expands the super-class list, since then you can put
a cond-expand there.

Patches welcome ...

Instead, I've tried this:

(define-simple-class<my-application-adapter>  ((<java.lang.Class>:forName
"com.apple.eawt.ApplicationAdapter"))
...)

However, I get an "invalid super type" compile-time error.

Yep - the super-type-list needs to be resolved at compile-time. -- --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]