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

I wonder what the Erlang equivalent would look like (passing around data that are funs)?


I'm mostly an Erlang guy, but I do like that about Elixir: they really seem to be taking the Erlang base, and building on it in some interesting ways.


That's the macros. Phoenix's routing is an awesome example of the power of Elixir macros. It leverages the BEAMs pattern matching capabilities to do the routing, but the syntax is very clear and concise.


Minor nitpick. BEAM doesn't have pattern matching built-in. Core Erlang does. Core Erlang compiles to BEAM bytecode with functions using regular if-statements. So basically: Erlang/Elixir -> Core Erlang -> BEAM. (Actually, I think there is one more step there).


Minor nitpick to the nitpick, since I dug down in Elixir's compiler before. Elixir spits out a normal Erlang AST, not a Core Erlang AST, which is a bit different. There are a half dozen levels between the Erlang AST and BEAM as well. There's several instances of a talk by Robert Virding about implementing languages on the BEAM where he talks about which advantages different levels of the compiler to hook into.


The closest thing I can think of outside of using funs or macros to define the usual `delay` and `force` operators, and that currently exists, would be something like the QLC interface, which allows you to turn whatever you want into a type that can be used in list comprehensions and functional queries around it: http://www.erlang.org/doc/man/qlc.html




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

Search: