I don’t know any ruby but I dabbled in elixir and I gotta ask: why do you prefer parenthesis-less function calls?
I like when parens/brackets are reliable wrappers for chunks of code. Like being able to ‘vi{‘ in vim to select a function body. Or ‘%’ to jump to the matching paren.
Do you find the language more readable without it? Less visual noise?
> why do you prefer parenthesis-less function calls?
I don’t feel strongly about it, but you gotta admit that this is remarkably easy on the eyes yet also easy to follow:
parts = version_string.to_s.split(”.”).map(&:to_i)
The Elixir equivalent, likely a series of pipes, would be just as easy to follow but substantially more to read, more symbols to parse etc. I don’t feel like this here line of Ruby makes any sacrifices in understandability compared to this Elixir port we’re both imagining.
To me the latter is no less clear so yeah, substantially more.
For context I write Elixir once a week and Ruby once a decade. In particular in this case elixir’s (and erlang’s) arity disambiguation (the slash) seems like unhelpful noise. Enum.map only accepts single-arity functions so it seems weird to me that the language couldn't figure that out for me.
Yeah, I don’t really understand the hatred for parentheses. Lisp famously has parentheses everywhere, and it looks a bit noisy at first but the precedence and scope is never ambiguous and with Vim you can always do % to find the match.
I would even say that the parens are a huge benefit of lisp. I guess that’s obvious though cause parens are like half the syntax.
But once you get used to it:
- you don’t really notice the parens anymore (definitely not the trailing ones anyway)
- you get the advantages of structural editing. So many nice shortcuts for moving stuff around. After working in clojure, typing typescript feels so clunky. How do you focus the next argument? Jump to the enclosing function scope? Yank the body of the closure? You just have to actual navigate to those things and select them, so uncouth!!
I like when parens/brackets are reliable wrappers for chunks of code. Like being able to ‘vi{‘ in vim to select a function body. Or ‘%’ to jump to the matching paren.
Do you find the language more readable without it? Less visual noise?