News for hackers. Stuff that matters.
Re:Elixir Streams by _nato_ on Monday June 08, 2015 @05:12PM (#9682463)
I wonder what the Erlang equivalent would look like (passing around data that are funs)?
Re:Elixir Streams by davidw on Monday June 08, 2015 @05:22PM (#9682543)
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.
Re:Elixir Streams by mjs2600 on Monday June 08, 2015 @06:06PM (#9682783)
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.
Re:Elixir Streams by Skinney on Tuesday June 09, 2015 @03:53AM (#9684548)
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).
Re:Elixir Streams by asonge on Tuesday June 09, 2015 @06:50AM (#9685053)
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.
Re:Elixir Streams by mononcqc on Monday June 08, 2015 @08:35PM (#9683415)
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