5 ms·
>one persons 'lack of expressive power' is another persons 'this code is easy to read'. Expressive translates to "easier to read". Having 100 lines of very si
by coldtea 10y ago
>one persons 'lack of expressive power' is another persons 'this code is easy to read'.
Expressive translates to "easier to read".
Having 100 lines of very simple procedural statements to accomplish what an expressive language does in 5 higher level lines doesn't make the 100 lines easier to reason about or maintain.
At worse it makes reasoning about their memory/speed beahavior harder -- but when it comes to reasoning about their functionality and the correctness of your program it's orders of magnitudes easier.
- collyw 10y agoI agree. If I am doing something "complicated", that won't be obvious to a beginner, I put a comment beside it. Having two or three lines as opposed to 20 or 30 is often easier to read if you ask me.
- dilap 10y agothere's defnly some truth to this -- more concise (via expressive power) code can be easier to grok, because it's easier to see the forest w/o so many trees in the way. but on the other hand, having simple code where it's easy to point at each bit and say 'that does this, that goes here' can also make code easier to understand. for me personally, on balance, the latter wins outweigh the former losses when going from python -> go. i'd say it's probably a small bump down in expressiveness for a large jump up in 'look and know what it does'-ness. (it's not like go is really missing that much that python has -- maybe list comprehensions (which are great!), tuples, and generators?) it'd be fun to do some empirical investigation of these things. take some toy problem, code up idiomatic, by-the-language-advocates solutions, and then throw them at large groups of people asking them to make some change, or fix some deliberately introduced bug, and see how the #s came out. :)