#1096 Java class literals ?

alex_panchenko Mon 17 May 2010

Hello,

Today we've met the case when java class literal should be used. In java they are specified as e.g. List.class. In Fantom we've found only Class.forName("java.util.List"), but it doesn't look nice.

What are other possible ways to specifiy it? Something like DSL or Type.toClass() method call?

Thank you, Alex

brian Tue 18 May 2010

Thats an interesting issue, not sure what the best solution is. The simplest thing would be to do something like this:

JFrame#->toClass

In the JVM, we could optimize that a single bytecode.

DSL would be another solution, although not sure what it would look like? Maybe something like:

JavaClass<|JFrame|>

Any other ideas?

ivan Tue 18 May 2010

I like the DSL. However it is unclear where it should be located? Sys pod does not seem like a good place. Considering we can have multiple FFIs in the future, probably something like this?

FFI<|[java]JFrame|>

Or even like this?

[java]JFrame#

brian Tue 18 May 2010

For now, I added support for using Type->toClass to get the java.lang.Class

changeset

Login or Signup to reply.