Depends on whether you need whatever is in Haxe's standard library, I guess?
I have a Kotlin program running on Windows, Linux with X11, Java with Swing, as well as in the browser, i.e. targeting native, JS and Java. That seems pretty portable to me. You just need to provide an implementation of whatever API you need on each platform you target.
Well, your portability for Windows and Linux is just from the JVM no? What does Kotlin add that java didn't?
And your Kotlin to JS, when you say target API? I mean, how similar is it to your JVM one? If you had to rewrite everything you were using Swing for, that's a lot of rewrite.
I think with Haxe, though not sure, but it's my impression with Haxe it would be almost 100% same code. Because whatever UI framework you'd used in Haxe is in the standard library, and would therefore be availaible on all its target platforms.
Hum, actually I take that back, it seems HaxeUI supports most platforms but not HTML5. Though HaxeUI2 seems to be in development adding support for it.
Ok, I see what you mean then. I don't know if I'd call that truly portable, but if they add native WxWidget and say QT to Kotlin native, it would slowly tend towards what Haxe has going.
I don't really think of that as portable personally. So many languages offer it today, Java with GWT, Clojure/ClojureScript, Kotlin, OCaml/BuckleScript, PureScript, Ruby/Opal, Python/PyJamas, Erlang/Shen, Scala, etc.
You save a bit of time not having to learn another language, and can reuse all pure code, mostly. But I'd really like to see a language develop which supports multiple platforms from the get go by having a unified standard library that was very complete, including UI.
> Well, your portability for Windows and Linux is just from the JVM no?
No, there is a native binary executable for Windows and a corresponding one for Linux. There is no Java embedded in or required by those, although separately (!) I also target Java, in addition to Windows and Linux. (I knew I should have used more parentheses in that post.)
> If you had to rewrite everything you were using Swing for, that's a lot of rewrite.
Yeah, but there is no Swing on the web, so what can you do? We used to have Swing, in the form of applets, and it was horrible. If you want something to work well on the web, you have to write it for the web. (But you can write it in Kotlin!)
Again, there is no Java when you target JS. Instead you can use any JS API and any JS library. The Kotlin standard library provides some basic data structures, math functions, etc. No Java.
> if they add native WxWidget and say QT to Kotlin native, it would slowly tend towards what Haxe has going.
wxWidgets and Qt happen to be in C++, which is difficult to use from other languages, but you can use any C-based library from Kotlin/Native, such as GTK+ or the native Win32 API.
I have a Kotlin program running on Windows, Linux with X11, Java with Swing, as well as in the browser, i.e. targeting native, JS and Java. That seems pretty portable to me. You just need to provide an implementation of whatever API you need on each platform you target.