#2338 Fantom to/from Java to/from .Net (Mono)

lib7 Fri 29 Aug 2014

Hi,

First, I'd like to say that Fantom appeals to me because of its pursuit for simplicity as well as practicality.

I've read some documentation, but there are some things that are not clear to me, maybe because I've never programmed for the JVM. My experience comes from C++ (far from knowing it well), Php, Python, Bash, some C and a bit of others.

  1. There are some examples of Fantom calling Java libraries and the opposite as well. But the aim of the language seems to be to substitute bloated Java libraries by Fantom ones (good!). But if necessary, can one call every kind of Java library if one so desires? Can every Fantom program/library be called by a Java program?
  2. I understand that Fantom compiles to .Net (that I don't know either). But assuming I could use Mono, could I use .Net libraries instead of Fantom or Java ones? Or there are restrictions? Can an existing .Net program use any Fantom library?

Thanks in advance for any answers.

SlimerDude Fri 29 Aug 2014

the language seems to substitute bloated Java libraries with Fantom ones

While the Java / Fantom interop is really good, if a library is written in Fantom then it can make use of Fantom constructs - meaning the resulting API is a lot cleaner and smarter.

Plus, when writing in Fantom, its not usually that difficult!

can one call every kind of Java library if one so desires?

Probably. If you're talking about plain method calls, then yes. It may get hairy if you try mixing Fantom Actors and Java Threads. These are more under the hood JVM constructs than statically typed Java classes.

Can every Fantom program/library be called by a Java program?

A similar answer. I also had problems with Tapestry5 because it wanted my code in different, pre-defined, packages and Fantom places all pod code in the one package.

I understand that Fantom compiles to .Net

Somewhat, I believe work on that is still ongoing.

could I use .Net libraries instead of Fantom or Java ones?

I don't know.

Can an existing .Net program use any Fantom library?

I don't think there is much .NET interop at the moment, so probably not. I did write Fancom though, which (with a bit of work) communicates with COM libraries.

Login or Signup to reply.