Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I though Elixir was not a whole new compiler, more like coffeescript:javascript than clojure:java.


No, it is not like coffeescript:javascript. Coffeescript compiles to javascript source code, which is then turned into bytecode by the VM. Elixir is _NOT_ compiled to Erlang source code; rather, it is compiled directly to BEAM bytecode.

So the clojure:java comparison is accurate.


Actually, it compiles to Core Erlang, which compiles to BEAM bytecode.

Core Erlang is pretty unreadable though, so I do think it's a bit more complex than CoffeeScript.


Elixir also gives you really cool meta-programming tools, a way to extend the language, that aren't part of CoffeeScript.


I can't say for sure, but I don't think it would be impossible to add that kind of capability to coffeescript, but you are right that right now coffeescript can't do that


Some people tried IIRC but they never got very far. One reason could be that syntactic abstraction is generally not in great demand, but could be something else entirely. Also, take a look at Sweet.js


"Elixir compiles directly into BEAM byte code."

from http://elixir-lang.org/crash-course.html


Elixir currently compiles to the Erlang abstract parse tree. This then gets to be BEAM byte code later on.


Good catch. I will fix the crash course.


AFAICT, it reuses components of the Erlang compiler for emitting the actual BEAM code and instead targets an AST that the compiler makes use of. I believe the goal is to eventually target Core Erlang (a different but simpler language that Erlang can be compiled to, similar to Core Haskell). Other projects like LFE make use of Core Erlang already.


Ok, that makes sense and explains my vague memory. Not source->source transformation but very different from something like scala where it really is a totally ground-up new compiler.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: