As Java 8 disappointed me, now I'm in a search for a JVM targeted language that is simple, fast and production ready. At the
moment I'm considering Fantom for its pros and cons:
Pros:
simplicity
immutability and Actors model built it (I liked it in Scala already)
declared execution speed
Cons:
Bad IDE support. For production a good IDE support is of essential importance for language market success. Look at what authors of Kotlin say. They don't hide the fact that they expect Kotlin to boost sales of their IntelliJ IDE. With no excuses, Fantom plugin for IntelliJ IDEA must be updated as soon as possible.
It is not quite clear for me how wellFantom will interoperate with Java 8, especially with JavaFX 8? JavaFX 8 is a very important library for the team I'm working with. As our main app development is related to media apps and scientific calcs for the desktop we choosed JavaFX as our main tool for the frontend so we'll need easy access to it. Whether Fantom will be the right language for that task? Are there any examples?
As I have mentioned that our focus is on scientific apps (image processing, data mining, FEM preprocessing etc.), the inability of Java FF to reference multi-dimensional Java arrays is a big issue for us, no doubt about that. When that feature will be available in Fantom? Do you have a road map?
Lack of the Java byte and float types is also a big problem for image processing.
Are there any commercial providers for Fantom web hosting?
Why there is no tutorial in PDF?
What about compilation speed? Is it as fast as for Java or Kotlin?
SlimerDudeTue 12 Aug 2014
Hi Rasa!
To address your points:
IDE support. The F4 IDE is pretty good if you're an eclipse fanboy (like me!)
The IntelliJ plugin could probably be updated, but alas, as Fantom isn't owned by JetBrains, it'll never be as good as the Kotlin plugin.
Then there are other editor choices as mentioned on the IDE page.
I've not used Java8 or JavaFX - sorry.
There's util::IntArray and util::FloatArray but I've never tried to create / manipulate a array of these. If it's not possible in Fantom, you could always write your own Java file for specific operations and call into that.
The Fantom Float is Java's double - do you really need the 32-bit version?
Any provider / VM that can host Java applications can also host Fantom web applications. I use Heroku myself.
I have never compared compilation speeds! Actually, I can never remember a time (in Java or other) when compilation speed was an issue. Wow, how big are these applications you're thinking of building!?
rasaTue 12 Aug 2014
Thank for the quick answer.
Yes, in image processing it matters. Java byte, int and float are of essential importance.
It would be nice if we could have an option to convert Docs tree, or parts of it, into pdf format.
Give yourself a try with Scala and measure its compilation speed, even for small projects.
SlimerDudeTue 12 Aug 2014
Hmm... Fantom's FFI converts all Java bytes, ints and floats into Java longs and doubles. You may need to write your own Java wrappers to manipulate them.
Wow, I didn't realise Scala had compilation speed issues. F4 builds my entire Fantom project (and dependant projects) when ever I make a single change. I can't say ever I've noticed any issues... (unless I have like 12 projects open!)
brianTue 12 Aug 2014
@rasa,
Regarding compilation speed I think you will Fantom compiles very fast for a compiler hosted by the JVM. It is difficult to compare apples to apples against other languages. But as an example the compiler pod itself is a fairly complex module which on my machine compiles in 2.2sec.
Regarding Java primitive types such as byte, int, etc - the JVM doesn't actually support byte or short at the stack machine level. For example when doing any computation on bytes the JVM always does 32-bit integer computations. These types are only optimized when combined with arrays. What Fantom does is provide various APIs to work with these optimized arrays. The most important API is sys::Buf which is the best way to with byte data and is a highly optimized API. The util::IntArray and util::FloatArray classes are used work with 8, 16, 32, and 64-bit integers/floats. They provide the same level of performance as Java with the addition of one wrapper Object. However all computations on the stack in Fantom are done using 64-bit integers and floats. Java supports both 32-bit and 64-bit opcodes. I did a bunch of testing early on and didn't see a huge difference in performance b/w the two - especially on 64-bit CPUs. But it is something to take into account. In general I think the best way to handle super specialized cases is to design a really nice Fantom API and then hand optimize the low-level bits in Java (for example look at how util::IntArray is implemented).
rasaTue 12 Aug 2014
Thanks. For now, Java 8 and Kotlin seems to be a better choice for me, but I'll certainly invest some more time in learning Fantom as I highly appreciate its intention to remain simple and fast.
Edit: We were writing at the same time, so I didn't saw your post. I'll take into account what you said and gonna investigate this topic a little bit more. Thanks.
MenguThu 14 Aug 2014
@rasa
i've a scala + play 2.3 app, it's not that huge, i have around 10-15 scala source files and maybe LOC is around 3K in total. i can assure you that this scala app is taking too much time to compile and run than a fantom app i'm working on which is around 50 times larger.
the scala app compiles in between 10-20 secs and fantom app (with 528 fantom source files) compiles in 14 secs. you do the math. :)
rasaThu 14 Aug 2014
Thanks. I've expected such result. I used Scala earlier, but not for a long time. Didn't liked anything related to Scala: bad IDE support at that time, long compilation, too academic nature of language (just wait to see docs), huge Lift dependencies etc.
I'm still browsing the Fantom ecosystem. Yesterday I had visited fanzy.net and got excited seeing that it incorporates Ruby syntax for closures. I used RoR several years ago at the time I was involved into web development, but not any more. Nevertheless, Ruby syntax is something that really attracts me. But, there some things that annyos me e.g.:
array := Int[1, 2, 3]
Why didn't you use Java like syntax for such construct:
array = Int{1, 2, 3}
and why do you chose Pascal operator := for assignment?
Also, can't figure out for what purpose do you use single = sign at all?
:= is the initialization operator, use it when declaring a new variable.
= is the assignment operator.
x := 9
x = 6
The differentiation is so we can use type inference without the need for a special keywords like var. It also helps avoid stupid bugs such as the unintended initialization of new variables.
The history and complete understanding of the := operator goes way back to one of the first postings in this discussion board: Def Assign.
Personally, I also disliked it when I first started Fantom... now I don't notice it all!
LightDyeThu 14 Aug 2014
fantom app (with 528 fantom source files)
@Mengu: That's a fairly large project. Out of curiosity, what IDE are you using, please?
I'm also interested in what IDE best serves Fantom languge? Note that there is an obsolete Fantom plugin for my beloved Intellij IDEA, but right now I'm not ready to evaluate its functionality as I'm pretty n00b in Fantom lang. Is there anyone who could compare it with other IDEs?
SlimerDudeFri 15 Aug 2014
@mengu - Wow, that is a large project! And I thought I wrote a lot of Fantom!
rasaFri 15 Aug 2014
This seems to be impossible in Fantom:
class SwitchTest {
Void main() {
i := 5
switch (i) {
case (1..10).contains(i) : echo("${i} is in range")
// case i in (1..10)
// i in (1..10)
// i in 1..10
default : echo("app shouldn't get here")
}
}
}
Yes, this construct could be easily resolved with an if-else statements, but wouldn't it be nice if you could have added a new statement like when from Kotlin, or even better match from Scala? Switch statement may remain as is. It doesn't matter. Do you have plans on that?
brianFri 15 Aug 2014
Switch statement may remain as is. It doesn't matter. Do you have plans on that?
No current plans to enhance that
rasaFri 15 Aug 2014
That's a pity as it is for years one of the most demanding feature for Java.
MenguFri 15 Aug 2014
@SlimerDude, @LightDye
the project is not mine, i'm maintaining it and developing new features and fixing bugs.
emacs is my primary editor. i've installed the fan-mode and that's just all. i use it for python, ruby, scala, coffeescript (javascript as well) and fantom.
rasaFri 15 Aug 2014
@Mengu, what kind of application is that one? I'm just curious as I don't find Fintom appropriate for image processing, so I would like to hear opposite opinions and some successful stories.
tomclSun 17 Aug 2014
FWIW
Coming to Fantom I too found lack of matching a strange ommission. There are a collection of features that go together: (anonymous) tuples matching style switch union types (as in ML) with type matching switch
anonymous tuples just don't seem good when you think about how and why they are used. they are basically a way to avoid declaring a convenience class when you want that to document data fields. In the context of the rest of Fantom the minusses outweigh the plusses, even though I tend to use them if they are given.
matching style switch - I'm neutral about this - but it needs either tuples or union types to make sense
union types. I miss these. They could be added to the static type system fairly easily and express important semantics. Then it would make sense to have a matching switch for them, and it could be used for other stuff too.
Brian and Andy have as a principle that Fantom type system should not be too complex. Personally I'm not sure that they have got this right yet - both better generics and union types are enhancements that increase the amount of error checking done for free by the complier. But there are consequences to any extension and I can't say I understand enough about what they are to make an informed choice. My view is conditioned by having spent some time with ML which has a very neat and coherent but expressive static type system with high order functions, polymorphic typing (generics) and union types with very nice matching syntax for union types.
MenguTue 19 Aug 2014
@rasa
if java is appropriate for image processing then fantom is appropriate as well.
rasa Tue 12 Aug 2014
As Java 8 disappointed me, now I'm in a search for a JVM targeted language that is simple, fast and production ready. At the
moment I'm considering Fantom for its pros and cons:
Pros:
Cons:
SlimerDude Tue 12 Aug 2014
Hi Rasa!
To address your points:
The IntelliJ plugin could probably be updated, but alas, as Fantom isn't owned by JetBrains, it'll never be as good as the Kotlin plugin.
Then there are other editor choices as mentioned on the IDE page.
util::IntArray
andutil::FloatArray
but I've never tried to create / manipulate a array of these. If it's not possible in Fantom, you could always write your own Java file for specific operations and call into that.Float
is Java's double - do you really need the 32-bit version?rasa Tue 12 Aug 2014
Thank for the quick answer.
SlimerDude Tue 12 Aug 2014
brian Tue 12 Aug 2014
@rasa,
Regarding compilation speed I think you will Fantom compiles very fast for a compiler hosted by the JVM. It is difficult to compare apples to apples against other languages. But as an example the
compiler
pod itself is a fairly complex module which on my machine compiles in 2.2sec.Regarding Java primitive types such as byte, int, etc - the JVM doesn't actually support byte or short at the stack machine level. For example when doing any computation on bytes the JVM always does 32-bit integer computations. These types are only optimized when combined with arrays. What Fantom does is provide various APIs to work with these optimized arrays. The most important API is
sys::Buf
which is the best way to with byte data and is a highly optimized API. Theutil::IntArray
andutil::FloatArray
classes are used work with 8, 16, 32, and 64-bit integers/floats. They provide the same level of performance as Java with the addition of one wrapper Object. However all computations on the stack in Fantom are done using 64-bit integers and floats. Java supports both 32-bit and 64-bit opcodes. I did a bunch of testing early on and didn't see a huge difference in performance b/w the two - especially on 64-bit CPUs. But it is something to take into account. In general I think the best way to handle super specialized cases is to design a really nice Fantom API and then hand optimize the low-level bits in Java (for example look at howutil::IntArray
is implemented).rasa Tue 12 Aug 2014
Thanks. For now, Java 8 and Kotlin seems to be a better choice for me, but I'll certainly invest some more time in learning Fantom as I highly appreciate its intention to remain simple and fast.
Edit: We were writing at the same time, so I didn't saw your post. I'll take into account what you said and gonna investigate this topic a little bit more. Thanks.
Mengu Thu 14 Aug 2014
@rasa
i've a scala + play 2.3 app, it's not that huge, i have around 10-15 scala source files and maybe LOC is around 3K in total. i can assure you that this scala app is taking too much time to compile and run than a fantom app i'm working on which is around 50 times larger.
the scala app compiles in between 10-20 secs and fantom app (with 528 fantom source files) compiles in 14 secs. you do the math. :)
rasa Thu 14 Aug 2014
Thanks. I've expected such result. I used Scala earlier, but not for a long time. Didn't liked anything related to Scala: bad IDE support at that time, long compilation, too academic nature of language (just wait to see docs), huge Lift dependencies etc.
I'm still browsing the Fantom ecosystem. Yesterday I had visited fanzy.net and got excited seeing that it incorporates Ruby syntax for closures. I used RoR several years ago at the time I was involved into web development, but not any more. Nevertheless, Ruby syntax is something that really attracts me. But, there some things that annyos me e.g.:
Why didn't you use Java like syntax for such construct:
and why do you chose Pascal operator := for assignment?
Also, can't figure out for what purpose do you use single = sign at all?
SlimerDude Thu 14 Aug 2014
ahhatem
gives a good overview in this topic:The history and complete understanding of the
:=
operator goes way back to one of the first postings in this discussion board: Def Assign.Personally, I also disliked it when I first started Fantom... now I don't notice it all!
LightDye Thu 14 Aug 2014
@Mengu: That's a fairly large project. Out of curiosity, what IDE are you using, please?
@rasa: Although still work in progress, you can download this Fantom book in multiple formats, including PDF: https://www.penflip.com/Hertz/programming-language-fantom-1-0
rasa Fri 15 Aug 2014
Thanks @LightDye. I already knew about that link.
I'm also interested in what IDE best serves Fantom languge? Note that there is an obsolete Fantom plugin for my beloved Intellij IDEA, but right now I'm not ready to evaluate its functionality as I'm pretty n00b in Fantom lang. Is there anyone who could compare it with other IDEs?
SlimerDude Fri 15 Aug 2014
@mengu - Wow, that is a large project! And I thought I wrote a lot of Fantom!
rasa Fri 15 Aug 2014
This seems to be impossible in Fantom:
Yes, this construct could be easily resolved with an if-else statements, but wouldn't it be nice if you could have added a new statement like when from Kotlin, or even better match from Scala? Switch statement may remain as is. It doesn't matter. Do you have plans on that?
brian Fri 15 Aug 2014
No current plans to enhance that
rasa Fri 15 Aug 2014
That's a pity as it is for years one of the most demanding feature for Java.
Mengu Fri 15 Aug 2014
@SlimerDude, @LightDye
the project is not mine, i'm maintaining it and developing new features and fixing bugs.
emacs is my primary editor. i've installed the fan-mode and that's just all. i use it for python, ruby, scala, coffeescript (javascript as well) and fantom.
rasa Fri 15 Aug 2014
@Mengu, what kind of application is that one? I'm just curious as I don't find Fintom appropriate for image processing, so I would like to hear opposite opinions and some successful stories.
tomcl Sun 17 Aug 2014
FWIW
Coming to Fantom I too found lack of matching a strange ommission. There are a collection of features that go together: (anonymous) tuples matching style switch union types (as in ML) with type matching switch
anonymous tuples just don't seem good when you think about how and why they are used. they are basically a way to avoid declaring a convenience class when you want that to document data fields. In the context of the rest of Fantom the minusses outweigh the plusses, even though I tend to use them if they are given.
matching style switch - I'm neutral about this - but it needs either tuples or union types to make sense
union types. I miss these. They could be added to the static type system fairly easily and express important semantics. Then it would make sense to have a matching switch for them, and it could be used for other stuff too.
Brian and Andy have as a principle that Fantom type system should not be too complex. Personally I'm not sure that they have got this right yet - both better generics and union types are enhancements that increase the amount of error checking done for free by the complier. But there are consequences to any extension and I can't say I understand enough about what they are to make an informed choice. My view is conditioned by having spent some time with ML which has a very neat and coherent but expressive static type system with high order functions, polymorphic typing (generics) and union types with very nice matching syntax for union types.
Mengu Tue 19 Aug 2014
@rasa
if java is appropriate for image processing then fantom is appropriate as well.