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

I agree with all of the above.

I would just like to add that in Elixir meta-programming does not always have to deal with macros.

For example, this program

    somelist = ... # any kind of data,
                   # could be loaded from file
    defmodule M do
      for {name, value} <- somelist do
        def lookup(unquote(name)), do: unquote(value)
      end
    end
generates a set of functions from arbitrary input. This feature alone greatly improves productivity in certain use cases.

While it is true that Erlang's parse transforms are more powerful by default, nothing would stop a willing heart from implementing token-level macros for Elixir. It would be a separate program that would parse source code before passing it on to the Elixir compiler.

But given the straightforwardness of code generation in Elixir (as exemplified by the code above), coming up with such a program might prove to be even easier for the user than dealing with parse transforms in Erlang. This is a speculation on my part, so it'd be curious to see if anyone goes in this direction in the future.



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

Search: