Hacker News new | ask | show | jobs
by klibertp 4764 days ago
So exactly like Coffee - it enables you to do class-based inheritance and mixins which is NOT possible in JavaScript... without writing 10x more code.

Standard library of Elixir should be available to pure Erlang too, right? From what I recall from interoperability docs.

Could you post a tiny little example of metaprogramming in Elixir that would appeal to quite experienced Erlang developer who knows about parse transforms? I am NOT dismissing Elixir, I know too little about it and I want to finally learn about some feature that would convince me to learn some Elixir.

1 comments

1) Do you also think of e.g. Scala as the CoffeeScript of Java? Scala : Java :: Elixir : Erlang

2) Yes, interoperability is there and, just like you can use Scala libraries from Java, you just need the Elixir runtime in your path.

3) My favorite is from the String.Unicode module:

    defmodule String.Unicode do
      # ...

      def upcase(""), do: ""

      lc { codepoint, upper, _lower, _title } inlist codes, upper && upper != codepoint do
        def upcase(unquote(codepoint) <> rest) do
          unquote(upper) <> upcase(rest)
        end
      end

      def upcase(<< char, rest :: binary >>) do
        << char >> <> upcase(rest)
      end

      # ...
    end
Ok, I'm almost convinced - at least I'll give Elixir a try after I finish with Joxa. Any tips for someone who would like to learn Elixir fast? Is the "Getting Started" on Elixir page OK or should I search somewhere else?

As for Scala and CoffeeScript... well, that's a tough one. On some level they are very similar, but the differences are huge. I'd say they both, and Elixir, are in the same class of things with CS being on the lower level than Scala and Elixir.

Yes, the Getting Started guide is great. There is also Dave's book[1] and many talks done by José and Yurii[2].

[1]: http://pragprog.com/book/elixir/programming-elixir [2]: http://www.youtube.com/watch?v=m32CGvzixrQ

Introducing Elixir by Simon St Laurent is coming out soon. I read a pre-release version and it is exactly what you want.