News for hackers. Stuff that matters.
Re:Why Erlang Matters by namelezz on Thursday April 07, 2016 @04:51PM (#11450621)
Sometime I wonder why Elixir tries too hard to have Ruby syntax.

Erlang:

loop_through([H|T]) ->

  io:format('~p~n', [H]),

  loop_through(T);
loop_through([]) ->

  ok.
It seems convenient to use ';' to separate multiple definitions of a function compared to using 'end' in Elixir(function definition continues in the next block)

Elixir:

def loop_through([h|t]) do

  IO.inspect h

  loop_through t
end

def loop_through([]) do

  :ok
end
Re:Why Erlang Matters by aaron-lebo on Thursday April 07, 2016 @04:57PM (#11450656)
I believe, like Steve Yegge has said elsewhere, that programmers are lame, (and now paraphrasing) because they refuse to touch things that look odd.

Erlang's syntax may be more efficient, but a lot of people won't touch it becuase the syntax is unfamiliar. Elixir has a huge advantage in this. It might not matter to you specifically, but in the realm of adoption that is huge.

And honestly I really enjoy the syntax...

Re:Why Erlang Matters by bpicolo on Thursday April 07, 2016 @06:07PM (#11451072)
I mostly enjoy the syntax. Kind of hate that they made parentheses for function calls optional, especially since no-parentheses has ambiguous cases that behave weirdly (like with chaining syntax). Should be enforced.

Also, all the different import-related keywords are pretty confusing. Maybe that's improved though

Re:Why Erlang Matters by vvanders on Thursday April 07, 2016 @05:21PM (#11450826)
Does do/end make it much easier to build macros with Elixir?

I don't find either syntax to be off-putting but that's just me.

Re:Why Erlang Matters by rdtsc on Friday April 08, 2016 @01:26AM (#11452731)
True. I personally like Erlang's syntax more. I like single assignment variables, I like the structure and feel of it and so on. But Elixir is great too. I am glad it is there and is taking advantage of the BEAM VM. It definetily appeals to many Ruby-ist or those who used Python and are otherwise scared by a different syntax.
Re:Why Erlang Matters by crymer11 on Thursday April 07, 2016 @11:39PM (#11452428)
Still pretty new to Elixir, so I welcome any suggestions, but from my understanding (and based on Elixir's guides [1]), I think that the more idiomatic way to approach this is to avoid writing such a loop_through/1 function and instead just use:

  Enum.each(<the list>, &IO.inspect(&1))
or likely

  <series of data transformations resulting in list> |> Enum.each(&IO.inspect(&1))
Both return the :ok at the end of the loop, so Enum.each/2 looks to be functionally equivalent.

1 - http://elixir-lang.org/getting-started/recursion.html

Re:Why Erlang Matters by yelnatz on Thursday April 07, 2016 @08:17PM (#11451727)
Much of the Ruby influence is because the creator of Elixir (José) was previously from the Rails core team.