3 ms·
The similarities are exclusively because of the do..end Beyond that there's barely any resemblance.
by zinclozenge 8y ago
The similarities are exclusively because of the do..end
Beyond that there's barely any resemblance.
- mmartinson 8y agoThe optional parenthesis syntax is pretty similar and arguably a bit unfortunate, though wider adoption of the code formatter seems to largely correct this. It's nice in the console to type a bit less, but I can't imagine the utility of this in code that any other person is going to read.
- BenMorganIO 8y agoOften times when writing a macro or a function that should appear as though it's a part of a DSL, the advantage of turning off parenthesis can shine here. That's why parenthesis are optional with a lot of the Ecto macros.
- pdimitar 8y agoI agree. As an additional point, when you have auto-formatting on save, this can also enrich your insight about the DSL at hand. It has for me.
- mercer 8y agoOptional parentheses are pretty much a requirement considering how much of Elixir is actually 'just' macros. I'm very happy that the formatter adds them for me as much as possible though, because I'm also not a fan of how far Ruby takes it.
- BenMorganIO 8y agoAgreed. I used to remove parenthesis as often as possible. Looking back at the code, that may not have been the brightest idea. I really do like the coding convention though that lack of parenthesis can indicate a function meant to be a part of a DSL.
- pdimitar 8y agoAs a long-time Emacs user recently I finally bit the bullet and started working with VSCode (with vscode-elixir and ElixirLS installed). ...Gods, what a relief. Especially the automatic formatting on save is just a lifesaver. At certain point I would not mind if there is one formal syntax enforced like Go does. Ecto is practically the only library I use where I don't pay attention to parentheses. And the formatter has me covered afterwards.
- mercer 8y agoI was amazed to see how VSCode will suggest typespecs all over the place!