Live data from Hacker News

Hello Lua

haxe.org

11–20 of 74 posts

Re: Hello Lua

#11
post #7

From Haxe's introduction: > Its syntax largely follows the ECMAScript standard, but deviates where necessary. Anyone can tl;dr the main differences to JS?

It's much closer to ActionScript and ES4 than to ES5 or ES6/2015/Next/Harmony/Trickshot.LegitScript/whatever the latest ECMAScript standard is. The main difference is probably decent macro support. There's always the Cookbook ( http://code.haxe.org/category/beginner/index.html ) if you want to see for yourself.

Off the top of my head, Haxe has:

  block level scoping (vs. function level scoping)
  classic inheritance (vs. prototypes)
  distinction between hash and object (vs. nope)
  required semicolons (vs. still uncertain on that after 10 years)
There's also the whole raft of static typing features, but there's too many of those to mention.

Re: Hello Lua

#13
post #6

Earlier quoted context omitted.

Haxe is what ActionScript should have been. However (imo), it's hard to find a niche for it now. What does it get me that Perl and OCaml don't? I've been drawn to Haxe several times over the years, but have never really thought of a project, "huh, Haxe would be a great fit here". Maybe if I wrote a mobile game or something.

Haxe is really a formidable little virus. It does a lot of small things nicely, but doesn't have a single knock-out feature that you can trot out during language comparisons. However, all those little features add up over time and become addictive. You start really missing them when you go back to other languages. In the back of your mind you think of how you might solve something simply with abstracts or macros, or…

OCaml accommodates imperative programming just fine: `if` without `else`, `for` loops, single semicolons as statement delimiters (without enclosing statement blocks in parentheses), records and objects containing mutable data, etc. OCaml isn't like SML and Haskell, which do get in your way when you want to program imperatively push you a little bit more forcefully towards programming in a functional style.

On the other hand, Haxe lacks features like higher order modules and signature ascription, which give the programmer very fine-grained control over the scope of abstractions. Haxe's abstract types are more like what ML had in the 70's, before MacQueen invented the ML module system.

Re: Hello Lua

#15
If Haxe had an interpreter (not hscript as it is far too limited) I would use it for a lot. Now compiling takes too long. The JS version is quite fast but not good for everything. It's a fantastic product though; in my experience it is write once - run anywhere. With some tweaks but that's to be expected. Please someone implement an interpreter in Haxe for Haxe.

Re: Hello Lua

#16

Earlier quoted context omitted.

Haxe is really a formidable little virus. It does a lot of small things nicely, but doesn't have a single knock-out feature that you can trot out during language comparisons. However, all those little features add up over time and become addictive. You start really missing them when you go back to other languages. In the back of your mind you think of how you might solve something simply with abstracts or macros, or…

OCaml accommodates imperative programming just fine: `if` without `else`, `for` loops, single semicolons as statement delimiters (without enclosing statement blocks in parentheses), records and objects containing mutable data, etc. OCaml isn't like SML and Haskell, which do get in your way when you want to program imperatively push you a little bit more forcefully towards programming in a functional style. On the oth…

OCaml provides some nice syntactic sugar for imperative programming patterns like "if" statements. But, I wouldn't really call it an imperative language, as it has its roots firmly in ML (which is not such a bad thing after all).

Arguing that ML had a precursor to Haxe abstract types is well within reason, but I'm not so sure they're the same. I'll have to do some more reading.

Re: Hello Lua

#17
post #2

Haxe is one of the best kept secrets of the programming world. Created by none other than the author of curl, it's A C-ish, javascripty, but strictly typed language with almost infinite portability. It "compiles" to many different target languages, from PHP to Java to Python to C++ and more. It's fast, has a beefy standard library, well-documented system interfaces, and just feels fun. A remarkable accomplishment.

cURL was created by Daniel Stenberg, Haxe was created by Nicolas Cannasse. (EDIT: beaten) My favourite Haxe feature is compile-time macros. This leads to massive meta-programming and language extension capabilities. My least favourite aspect is that it does not strictly unify or abstract every target language & runtime, so you end up writing in that language's semantics but using Haxe as syntax sugar. (Good for C++,…

Can you explain what you mean by "not strictly unify or abstract every language & runtime"?

In day-to-day use, how would you notice this problem? Can you give an example of what problems or hurdles this can cause?

I've only used Haxe briefly for a few small game demos, and loved it, but I've only used the JS backend.

Re: Hello Lua

#18
Sorry for off topic, just a heads up for the maintainers of haxe.org. Several links in the footer, inside 'Learn Haxe' section are broken. They point to '/http...'.

Re: Hello Lua

#19
post #7

Earlier quoted context omitted.

It's much closer to ActionScript and ES4 than to ES5 or ES6/2015/Next/Harmony/Trickshot.LegitScript/whatever the latest ECMAScript standard is. The main difference is probably decent macro support. There's always the Cookbook ( http://code.haxe.org/category/beginner/index.html ) if you want to see for yourself.

Off the top of my head, Haxe has: block level scoping (vs. function level scoping) classic inheritance (vs. prototypes) distinction between hash and object (vs. nope) required semicolons (vs. still uncertain on that after 10 years) There's also the whole raft of static typing features, but there's too many of those to mention.

ES has all of those things except for requiring that a statement ends with a semicolon.
Post reply on HN