Re:Elixir vs. Erlang: a question of momentum
by k__ on Thursday April 23, 2015 @10:39AM
(#9426995)
But I still don't understand why Elixir didn't drop ends.
[ Parent
| on HN ]
Re:Elixir vs. Erlang: a question of momentum
by tormeh on Thursday April 23, 2015 @12:18PM
(#9427734)
I think they should keep the "end"s, but they should say what they end! "end function" tells me that a function ends here. "end if" tells me that an if statement ends here. "end" is just equivalent to "}".
Re:Elixir vs. Erlang: a question of momentum
by yellowapple on Thursday April 23, 2015 @03:45PM
(#9429323)
Some Ruby (and Elixir and Julia and other languages that use `end`) will just add a comment at the end of the `end` if they want to be more explicit about it. For example:
def foo(bar,baz) do
...
end # foo
This brings me to why a bare `end` makes more sense (in the case of Elixir, at least): because every use of `end` corresponds to a `do`. The above code is basically equivalent to `def foo(bar,baz) { ... }`, since `def` takes a function specifier and a block as its arguments.If you really don't like `end`, you can also (at least with Elixir) use the shorthand form:
def foo(bar,baz), do: ...> "end" is just equivalent to "}".
And an unnecessarily verbose one.
Re:Elixir vs. Erlang: a question of momentum
by yellowapple on Thursday April 23, 2015 @03:38PM
(#9429289)
Because it was heavily influenced by Ruby (no matter how much us Elixirists want to convince ourselves otherwise).
Alternately: what's wrong with `end`?