3 ms·
I never mind verbosity in a programming language. Making things succinct at the expense of readability is a poor choice in my mind. If you don't like to type, a
by warble 12y ago
I never mind verbosity in a programming language. Making things succinct at the expense of readability is a poor choice in my mind. If you don't like to type, any decent IDE can fix that for you.
- ptx 12y agoBut list comprehensions make things both more succinct and more readable. Compare: "Give me one scoop of ice cream of each kind that is chocolate-flavored." ...to: "I would now like you to prepare for looking over the ice cream flavors, and also to prepare a new list which I will later fill in. Consider the first ice cream flavor. Is is chocolate? If that is the case, I would like ... once that is done, consider the next flavor ... now add this flavor to the end of the list which we prepared earlier ... consider the next flavor..."
- sanderjd 12y agoI didn't complain about the amount of typing. Programming involves so little typing in general that bringing it up is always a red herring. I often don't mind verbosity in a programming language, but not never. The distinction is basically verbosity that makes common patterns noisy to read. The `function` keyword is that sort of verbosity in javascript. I think explicit returns are also that sort of verbosity in javascript. The language lends itself to using lots of anonymous functions, but because of the `function` keyword and implicit return, anonymous functions are very noisy. It doesn't help readability, it just results in long lines or stacks of lines to express simple concepts. I find this type of syntax discussion pretty superficial, but, for better or worse, syntax has a big impact on how programs are written in a language.