4 ms·
> it's also a cost on everyone who will have to read any of the code. Everyone who will have to read the code in the compiler or interpreter? Or everyone who r
by dmurray 4y ago
> it's also a cost on everyone who will have to read any of the code.
Everyone who will have to read the code in the compiler or interpreter? Or everyone who reads code in the language?
I'm not so sure the latter should be a consideration. If you don't give people some feature they would use, they will develop their own idioms to accomplish the same with what the language does provide. And the reader then has to become familiar with those idioms, and repeat the process for every new codebase they encounter in the language. Better to have one good way to do it.
- laurentlb 4y agoOf course, the feature itself brings value, so you have to balance the cost and the value. If something is used a lot, you can expect the reader to learn the pattern quickly. If something is not super common and not intuitive, it can make the code less readable (and the reader might spend a lot of time searching in the documentation). Two examples I've seen this week: - Python has a new keyword `except*` - C# has a prefix operator ^ It's not obvious to me that these features are beneficial in general.
- shanebellone 4y agoI love except. I use it for error handling and recovery.
- randallsquared 4y ago`except*` seems hard to search for and easy to confuse with `except`, raising some ambiguity about what you meant, here.
- shanebellone 4y agoYeah, I can see what you mean. I wasn't aware of "except*" aside from try/except.