
Elixir: Ruby-like Syntax and Homoiconicity for Erlang VM - rlander
http://elixir-lang.org/
======
metajack
Having rebinding of the vars and dictionary literals are really nice. The
syntax feels a bit awkward in general. Commas have to be in non-obvious
places, and the "do" keyword is essentially hard-coded. But these aren't huge
problems. The homoiconicity looks quite interesting.

The bigger problem is that it still has 90% of Erlang's semantics, and that
turns out to be just as different in Ruby-like syntax as it is in Prolog-like
syntax. I should note that this isn't a problem for _me_ , but if the aim is
to make the language more familiar to others, the syntax change is not much
help.

My team and I evaluated using Elixir for game scripting on an Erlang-based
engine, but ended up passing because if we were going to teach the scripters
Erlang semantics, we might as well just use Erlang. We also looked at LFE and
came to largely the same conclusion.

But, I applaud the effort and I plan to keep an eye on the project. We need
more of these kinds of developments on BEAM, and hopefully some of their good
ideas will trickle into the Erlang language itself.

~~~
josevalim
Hey metajack, glad you enjoyed some bits of the language and also thanks for
the criticism.

Designing a language requires some trade-offs and the "do" is one of them. It
is a keyword and its main goal is to reduce the number of parenthesis. You
could write this in Elixir:

    
    
      if true, do: (something; then_another_something)
    

But with do, you can give a many expressions straight away:

    
    
      if true do
        something
        then_another_something
      end
    

So, at first it may give the impression that the commas and do are aleatory,
but after you get the hang of the syntax, it will hopefully make your code
less noisy.

Finally, yes, the semantics in the end are Erlang semantics. My previous
attempt at writing a language for the Erlang VM machine was fighting against
Erlang semantics and that didn't end up well. :)

In the future though, you may choose to go with Elixir instead of Erlang
because of its features. Macros and protocols are good features to make you
more productive and your code more extensible. I am available for discussion
at #elixir-lang on freenode.

~~~
judofyr
Why isn't this possible?

    
    
        if true: (something; then_another_something)
        
        if true: do
          something
          then_another_something
        end
    

Then "do … end" is the same as "begin … end" in Ruby. Also, you might be able
to get rid of that colon too.

~~~
josevalim
That was a very simple example to explain which problem do/end is trying to
solve. We also need to consider how your changes would fit with if/else,
if/elsif/else and other macros like case/switch.

That said, please join #elixir-lang on freenode and I would love to talk with
you about your suggestions. Maybe we can figure out some improvements?

------
vasco
Ah, unfortunate name clash with <http://elixir.ematia.de/trac/wiki> which is a
python wrapper on top of sqlalchemy made me confuse for a second.

------
toisanji
I'd like to know the performance of this compared to erlang and ruby

~~~
josevalim
Benchmark the performance of this on its own doesn't provide much insight. In
any case, early benchmarks of the web server I am working on are available:

<https://gist.github.com/1582864>

Note it is still experimental, take everything in there with a grain of salt.

------
badboy
I like the ruby syntax and I played a bit with Erlang in the past. This looks
just like the perfect mix of both worlds.

~~~
vonkow
If this accomplishes what it seems to be attempting and makes erlang/OTP and
the BEAM more accessible to the ruby, python and js communities while
smoothing some of the language/platform's rough edges, I will be a _very_
happy camper.

------
ludicast
In the Ruby world my ordered policy for picking libraries (gems) is:

1) Jose Valim (+ Plataforma) wrote it

2) Ryan Bates covered it recently

3) It is doing well on the Ruby Toolbox

I've been meaning to quaff Elixir for a while (am frenemies with Erlang).
Maybe I'll write a HAML in it :).

------
raphinou
I would put a link to the mailing list on the homepage. For those interested,
it's here: <http://groups.google.com/group/elixir-lang-core>

~~~
josevalim
Just did that, thanks for the suggestion.

------
rhdoenges
That macro system isn't exactly homoiconicity. Maybe a first-class AST?

Whatever it is, I like it.

~~~
josevalim
That's a good discussion. I could not find any concrete specification of what
homoiconicity means. But there are other languages (like Erlang, Julia and
others) which provides the same kind of "first-class AST" and are called
homoiconic.

In any case, I believe we can agree what it is called doesn't matter much.
What we can do with it, does. :)

