5 ms·
While those decisions are completely meaningless as far as performance or correctness of your program goes, they do have value for readability. One way to deal
by hakunin 3y ago
While those decisions are completely meaningless as far as performance or correctness of your program goes, they do have value for readability. One way to deal with them is of course to install something like standardrb and never think about it. The other way is to read the code you just wrote, and see what reads clearer/better in a specific case.
- philwelch 3y ago> The other way is to read the code you just wrote, and see what reads clearer/better in a specific case. Yes, that's the extra decision step in my main workflow loop that I'd like to cut out whenever possible.
- hakunin 3y agoI think in general it's almost impossible to cut out human consideration and still get auto-clarity. With an auto-formatter you gain a little speed and lose a little readability. I think most people are really arguing about whether this trade off is worth it. Some are arguing that any readability gains are minimal (and debatable), but then it's like arguing that there's no point to being a better writer, and information can just be auto-formatted for human consumption with a set of standard heuristics. I guess we might actually get this world once everything is written by ChatGPT to maximize consistency. But then, how can we both claim to like complete and total mechanical consistency in code, and dislike it in any other form of writing? If code can be written more than one way, shouldn't we optimize it the same way for fellow devs as good writers would for their readers?
- philwelch 3y agoTo be blunt with you, I think Rubyists cling to optional parentheses for purely aesthetic reasons; all of the supposed Ruby “DSL’s” that are just method invocations without parentheses would be no less and arguably even more clear and readable with parentheses.
- hakunin 3y agoFrankly, parentheses was the last thing on my mind. I typically use them by default, and remove them in cases where it might make sense. Mostly I was thinking about stuff like arrangements of hashes, arrays, method arguments, naming of methods and variables, various styles of method chaining, block usage, etc.
- philwelch 3y agoSure, but that kind of stuff is not generally unique to Ruby.