153 points · by curtis · 11y ago · 64 comments
(at least it was for me...I was amazed at how fast Pope built and ported a cross-platform game considering he's a one-man shop...though to be fair, he was also able to learn Flash and build games for Ludum Dare competitions...so he's probably an outlier :) )
Another interesting thing to look at is the OCaml source for the Haxe compiler itself. https://github.com/HaxeFoundation/haxe
At first, I was hesitant to do much with the compiler since I don't know OCaml. But, I recently forked the source and am making an attempt at a lua target: https://github.com/jdonaldson/haxe/tree/haxe_lua_rb1
It's been a great way to learn OCaml, and Lua. If you're interested in creating your own Haxe target, I'm hoping my commit log will be helpful.
https://itunes.apple.com/us/app/world-zombination/id68062469...
Great looking game and near perfection on gameplay, idea, brand, art, assets, ui, icon etc. Flawless victory.
Here's a port of the jQuery TodoMVC for anyone wanting a quick example of what a web-target would look like. https://github.com/explorigin/todomvc-haxe
Besides that, the type system of Haxe is far more expressive than those of most languages that also compile to JS. Ocaml, Scala and Haskell are the better known languages that are actual competitors in that regard.
I'm unfamiliar with Ocaml, Scala and Haskell but OK.
I like the idea of this approach way more than the one that projects like Xamarin take (build a common runtime on top of each platform) because you don't incur any runtime overhead, and debugging would (in theory) be much easier because you can just debug the native language instead of needing to understand the extra VM layer on top. As a bonus, with Haxe you can also target the web, which you can't do with Xamarin/RoboVM/RubyMotion/etc.
Has anyone tried anything like this (not necessarily with Haxe) and had success with it?
[0]: https://github.com/ralcr/swift-target
Edit: Wording and clarification, added bit about targeting web.
Other uses for Haxe are the JavaScript target which a number of companies are using extensively in the same way you would be using typescript/coffeescript.
Could you speak to the specific "warts" you found while using it? I'm genuinely curious.
The sort operation is not guaranteed to be stable, which
means that the order of equal elements may not be retained.
For a stable Array sorting algorithm,
haxe.ds.ArraySort.sort() can be used instead.
Every platform has its own gaps in the API. This is evident in this submission - after the author translated his JavaScript he then had to fix his haxe to work within the subset available to C#.OpenFL isn't a mature platform and their releases are rushed and buggy. If you download and install <older OpenFL> their setup process will install the newest version of dependencies and their incomplete documentation will leave you to figure out what versions are actually compatible. Gestures are a pain in the ass with immature and incomplete libraries.
The one thing that makes it worth using - barely - is the decade and a half of ActionScript experience I also have.
If you're just looking for multi-platform stuff, that's almost a minimum requirement now: unity3d, unreal engine, xamarin, javascript etc.
This is pretty much the approach that Google use with Inbox, except they used j2objc instead of RoboVM.
I think the focus is going to be on generating objective c, rather than swift. Although, that's the entire extent of my understanding.
class Test {
static function main() {
var people = [
"Elizabeth" => "Programming",
"Joel" => "Design"
];
for (name in people.keys()) {
var job = people[name];
trace('$name does $job for a living!');
}
}
}The "people" instance is using anonymous syntax for a Map type. Haxe's Map types are actually abstract types: http://haxe.org/manual/types-abstract.html. I doubt many developers are familiar with this type of feature.
For instance, here's a "packed array" implementation that lets me store an array of integers in a fraction of the space usually needed for a standard array type: https://github.com/jdonaldson/packhx Abstract types let me use the same api that standard arrays use (including array accessors), even if the underlying runtime implementation is completely different.
The other nice things going on in the example is the simple for loop using an iterator, and the nice string interpolation. Granted, this is nothing super sophisticated, but it's great to have these same features across all the targets that Haxe supports.
If you have an example of a better code sample for introducing language syntax, I'd love to see it so I can learn from it.
for ((name, job) in people) {
trace('$name does $job for a living!');
}My problem with it is that it seems to have gone somewhat stale. It's been almost a year since the last update, and at least for the JS target, a number of the great external libraries never made the hop over to the 3.0 codebase.
You make a great point; just because a project doesn't put out updates once a week doesn't mean it's stale. There are some other great projects like haproxy and redis that are clean enough and stable enough that regular updates aren't necessary.
I guess you sort of grow accustomed to that mentality when dealing with some other common OSS projects
You should try the nightly builds or compiling straight from Git. They are stable enough for many purposes (and if you report a bug chances are that its fix will soon be available) and you can take advantage of new features.
By the way, there's a new release planned for the next weeks.
What does shared code mean in this context? Can someone give an example?