Re:Elixir: Ruby-like Syntax and Homoiconicity for Erlang VM
by judofyr on Friday March 02, 2012 @03:56AM
(#3655927)
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.
Re:Elixir: Ruby-like Syntax and Homoiconicity for Erlang VM
by josevalim on Friday March 02, 2012 @04:44AM
(#3656029)
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?
Re:Elixir: Ruby-like Syntax and Homoiconicity for Erlang VM
by syaramak on Thursday March 01, 2012 @10:36PM
(#3655235)
Great project. I really hope Elixir takes off. I can try to convince my bosses that the transition from Ruby to Erlang isn't going to be syntactically hard :)
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:
But with do, you can give a many expressions straight away: 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.