Le 13/09/2014 15:35,
j...@justinfront.net a écrit :
> I see the discussion on short Lambda's but really I don't see how a
> feature would really effect the fact that Haxe language is already one
> of the best languages out there, and certainly one of the most
> underestimated and flexible ones.
>
> But still I often wonder why Ocaml is better to code Haxe compiler in,
> having done a bit of functional reading I have some understanding. But
> the question remains... Haxe seems to excel in so many areas yet it fall
> short on the fast LLVM functional language slot, could we change that,
> what features would be needed would a new special target along side Neko
> be needed... ?
>
> Is there some fundamental reason why Haxe can not address, or will never
> be able to address, the Functional LLVM compiler aspect of coding?
A few things that makes OCaml better for compilers :
- a very efficient compiler and garbage collector : even if written in
Haxe, using the OCaml platform as a target would be necessary to reach
the speed of the current compiler
- tuples support, although this could be emulated with macros
- first class immutable lists - with corresponding pattern matching,
which are something we don't have
- currying : Haxe makes it explicit with .bind, it's implicit in OCaml
(but this creates restriction on optional parameters usage).
- structures are not objects, so this would require a specific optimized
way to define structures, this should be doable with abstracts+macros
I might forget a few additional things.
No real show stopper, but it means that would not be an easy task (and
we have also to port the 28K lines of the compiler (+37K lines for the
platform generators), which is not a lot but every small details count here.
It's still possible to write compilers in Haxe - I actually entirely
rewrote the HxSL compiler in Heaps.io with AGAL and GLSL output - but I
still feel that having the Haxe compiler in OCaml is better atm.
Best,
Nicolas