#636 Java and .NET support

BobDeAnna Thu 11 Jun 2009

I think this is a very interesting effort!

I have a couple of questions:

1) Do you support Java/.NET reflection?

2) Can you generate Fan code from a Java or .NET code base?

3) Does FWT support JME and Compact Framework ui libraries?

Thanks, Bob

brian Thu 11 Jun 2009

Hi Bob,

Do you support Java/.NET reflection?

Reflecting Java class or .NET classes is done with a FFI. For example in Java:

echo(ArrayList().getClass.getMethods.join("\n"))

We don't currently have a .NET FFI, but once we add it, you would just use the normal .NET reflection APIs.

That said, Fan has its own reflections API which are pretty tightly integrated into the language. Things like type literals and slot literals are used extensively with meta-programming.

Can you generate Fan code from a Java or .NET code base?

I expect you are asking is there a Java source code to Fan code translator? I am not aware that anyone has done a project like that, although it would be pretty slick. The key issue would be how to map the API calls.

Does FWT support JME and Compact Framework ui libraries?

The FWT code uses SWT on the Java VM as its widget toolkit. I know SWT runs on embedded VMs such as J9 (because I've used it in projects on embedded devices). To a large extent I've tried to keep Fan's Java code J2ME (1.4) compliant by avoiding generics, etc. However there a few places I've used enhancements such as StringBuilder instead of StringBuffer. But I expect getting to run on J2ME wouldn't be a big deal.

The Java support is definitely more mature than the .NET support. Hopefully over time the community will attract more .NET people who can help us bring Fan's .NET support up to par with Java. But the core language does run on the CLR - for example the compiler is self hosting (the work left is really in performance and in libraries).

Our latest efforts are on making Fan portable to JavaScript to run in the browser. This project is going quite well (although JavaScript makes a pretty poor "assembly language").

BobDeAnna Thu 11 Jun 2009

Brian,

Thank you for responding!

Reflection: sounds good

Java/.NET-to-Fan Source Code Generator: I understand. As you might imagine, this would facilitate folks moving over to Fan.

JME/Compact Framework support: Again, it makes sense going with SWT initially. Is there any time frame in mind for JME or Compact Framework support?

Do you have any UI support for .NET....it sounds like that currently the answer is no.

This is a great effort and I am going to stay informed of the progress.

Thanks again, Bob

brian Thu 11 Jun 2009

JME/Compact Framework support: Again, it makes sense going with SWT initially. Is there any time frame in mind for JME or Compact Framework support?

I guess if someone wanted to use Fan in a project for J2ME, I'd be open to trying to figure out how to make it work. The fact that J2ME is sooooooo old makes it tough to do with one codebase.

Do you have any UI support for .NET....it sounds like that currently the answer is no.

No, not yet. Basically it entails binding the FWT hooks to use WinForms (or whatever .NET ui technology du jour). We've prototyped just a few things like Labels to test it out, but still a pending project (what we have been doing is getting FWT to work in browsers via JavaScript - which is quite cool).

Login or Signup to reply.