4 ms·
At the expense of increasing the complexity to read code.
by satisfaction 6y ago
At the expense of increasing the complexity to read code.
- amw-zero 6y agoHow is the complexity increased?
- mypalmike 6y agoComplexity increase from reading it has.
- satisfaction 6y agoLaughed at this I did.
- sixstringtheory 6y agoAs you read through code you can come across a huge switch and not know why until you look to the end. Now you’re reading bottom-up, which is just as unnatural as right-to-left for english speakers. Not necessarily more complex, but not less complex either IMO. I often say complexity can’t be eliminated, only spread around differently; I think we’re seeing that here.
- satisfaction 6y agoI think it would be possible to think of this in terms of complexity theory, for N case statements to you would possibly have to check 2N locations for assignment. I wonder if you could do parallel assignment: var1 = case = var2
- eejjjj82 6y agoBecause now there are 2 ways to do the same thing with little obvious benefit other than syntactic bikeshedding. 2 ways to do something is more complex than 1. But it's more than just the syntax of the code. It now means new lint rules, new coding standards in projects (some will allow => assignment, some will encourage conformity to legacy code, and others will disallow it entirely). There will be new Rubocop rules and other editor configs to update for proper syntax highlighting. Syntactic changes like this with little obvious benefit need to be looked at skeptically. Just because something can be done, doesn't mean it should be.
- baash05 6y agoIt's actually very simple to illustrate. Say this 5 => x in english. (three words or less) Or this one cat => person.pet