3 ms·
I though Elixir was not a whole new compiler, more like coffeescript:javascript than clojure:java.
by TylerE 12y ago
I though Elixir was not a whole new compiler, more like coffeescript:javascript than clojure:java.
- untothebreach 12y agoNo, 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.
- andyl 12y agoElixir also gives you really cool meta-programming tools, a way to extend the language, that aren't part of CoffeeScript.
- untothebreach 12y agoI 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
- klibertp 12y agoSome 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
- taybin 12y agoActually, 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.
- linguafranca 12y ago"Elixir compiles directly into BEAM byte code." from http://elixir-lang.org/crash-course.html http://elixir-lang.org/crash-course.html
- strmpnk 12y agoAFAICT, 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.
- TylerE 12y agoOk, 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.