

Elixir: First impressions - antifuchs
http://boinkor.net/archives/2013/01/elixir-first-impressions.html

======
metajack
I don't think Erlang's syntax is at all inconsistent; it's just different.

Once you understand what periods, semicolons, and commas are actually doing,
there is no confusion. In the same way an English writer doesn't get confused
about when to use periods, Erlang's periods become invisible before long.

That's not to say they are awesome. They cause some issues with refactoring.
Moving a bit of code might involve also changing its ending punctuation. This
is also true in JavaScript, Python, and Ruby in list/map syntax. You just run
into it more with Erlang since there is more of it.

Pattern matching is also one of my favorite things about Erlang, especially
the binary syntax.

One example I particular like is the binary digest to hex representation[1]:

    
    
        hexstring(<<X:128/big-unsigned-integer>>) ->
            lists:flatten(io_lib:format("~32.16.0b", [X])).
    

[1] [http://www.enchantedage.com/hex-format-hash-for-
md5-sha1-sha...](http://www.enchantedage.com/hex-format-hash-for-
md5-sha1-sha256-and-sha512)

------
rdtsc
> I was always scratching my head over why this place needs a period and that
> place doesn’t

I like Fred Hebert's (author of <http://learnyousomeerlang.com/>) explanation
of syntax on his blog:

<http://ferd.ca/on-erlang-s-syntax.html>

At least the "template" explanation is most helpful to me.

> then there was just plain weird stuff like one-based indexes.

Interestingly, I don't think indexing is really that common in idiomatic
Erlang. In other words when processing lists, one can split them into head and
tail [H|T] or uses folds and maps.

~~~
antifuchs
Thanks for the link! I hadn't seen that one before. While I think I'm already
thinking in expressions, Erlang's placement of punctuation never really made a
lot of sense to me. Maybe that explanation will finally clear up my confusion.

So far, I agree with the note about 0/1-based indexing. It's just not used a
lot. However, I find it pretty calming that indexes will work the way I expect
them to, should I ever need to use them.

Now that I think about it, these two points (syntax and indexes) are somewhat
petty things to point out about the Erlang : Elixir relationship, and I feel a
bit bad for repeating them in the blog post. Things like protocols are way
more interesting (and hopefully, are what drives you to try out Elixir). (-:

~~~
rdtsc
I spent last night looking at Elixir and I really like it (at least as far as
I could see in one evening).

I like Erlang and I wouldn't say Elixir is there to replace it. I see a use of
Elixir for scripting or creating DSL. Also it gets a huge bonus by running on
BEAM. As far as internal design (and I am speaking as an amateur here), BEAM
is far superior to JVM from the reliability and concurrency point of view. So
having Elixir around is helping Erlang team, kind of like many see Scala and
Clojure as a way to make the Java ecosystem appealing and exciting again.

