I have recently come across Fantom and am very impressed by its capabilities to the extent that I would like to investigate it further for some new projects I have in the pipeline. The first of these would require me to be able to invoke Fantom class methods from within an existing JVM. I have searched though the discussions and found some quite old postings relating to this but the code snippets only seem to address an immediate issue that the author was trying to overcome at that point in the development of the language infrastructure. The documentation also seems to be very sparse on this issue (unless I have missed something or not fully understood the Java FFI). Now that Fantom has had another 2 years to mature since some of those postings were made I was wondering what the recommended method of achieving this goal is. Any input would be gratefully received.
Thanks Bob
brianTue 29 Jan 2013
Hi Bob,
Welcome to Fantom. I am not sure there is really any docs other than the JavaFFI chapter. That lists the special cases such as sys::Int mapping to java.lang.Long or long. But other than that, pretty much classes are just normal Java classes and mixins are just normal Java interfaces. The mapping is very clean, and if you aren't using functions it is pretty pleasant to use.
Sorry we don't have a specific docs on going from Java to Fantom - something we should add. In the meantime, if you have a specific question about how a construct in Fantom compiles into Fantom, just ask and I'll be happy to answer.
Bob147Wed 30 Jan 2013
Hi Brian,
Thanks for the reply. I have spent a bit of time mapping out my specific requirements which, as it turns out, are a mix of professional and personal. I have already had a good degree of success in modelling part of an existing application in Fantom + Tales with a view to converting at least part of a desktop app into a web server/client solution using Fantom's @Js capabilities. I have to say that I was more than impressed by how easy it was to get from a point of no understanding to a skeletal but partly functioning demo in just a few days of part-time effort. At first I was put off by what appeared to be a very steep learning curve but once I pulled apart a few of the examples the salient points quickly started to fall into place.
The outcome of this is that I have identified a more specific question but I will open a new thread for that one. For now thanks very much for Fantom...it now needs some powerful evangelists to help spread the word!
Bob147 Tue 29 Jan 2013
Hi Everyone,
I have recently come across Fantom and am very impressed by its capabilities to the extent that I would like to investigate it further for some new projects I have in the pipeline. The first of these would require me to be able to invoke Fantom class methods from within an existing JVM. I have searched though the discussions and found some quite old postings relating to this but the code snippets only seem to address an immediate issue that the author was trying to overcome at that point in the development of the language infrastructure. The documentation also seems to be very sparse on this issue (unless I have missed something or not fully understood the Java FFI). Now that Fantom has had another 2 years to mature since some of those postings were made I was wondering what the recommended method of achieving this goal is. Any input would be gratefully received.
Thanks Bob
brian Tue 29 Jan 2013
Hi Bob,
Welcome to Fantom. I am not sure there is really any docs other than the JavaFFI chapter. That lists the special cases such as sys::Int mapping to java.lang.Long or long. But other than that, pretty much classes are just normal Java classes and mixins are just normal Java interfaces. The mapping is very clean, and if you aren't using functions it is pretty pleasant to use.
Sorry we don't have a specific docs on going from Java to Fantom - something we should add. In the meantime, if you have a specific question about how a construct in Fantom compiles into Fantom, just ask and I'll be happy to answer.
Bob147 Wed 30 Jan 2013
Hi Brian,
Thanks for the reply. I have spent a bit of time mapping out my specific requirements which, as it turns out, are a mix of professional and personal. I have already had a good degree of success in modelling part of an existing application in Fantom + Tales with a view to converting at least part of a desktop app into a web server/client solution using Fantom's @Js capabilities. I have to say that I was more than impressed by how easy it was to get from a point of no understanding to a skeletal but partly functioning demo in just a few days of part-time effort. At first I was put off by what appeared to be a very steep learning curve but once I pulled apart a few of the examples the salient points quickly started to fall into place.
The outcome of this is that I have identified a more specific question but I will open a new thread for that one. For now thanks very much for Fantom...it now needs some powerful evangelists to help spread the word!
Bob