Version 0 of readability of code

Updated 2002-03-21 11:40:35

Martin Lemburg: I love readable code and using decr var 1 is more readable than incr var -1, or am I wrong?

RS In matters of taste, one self is mostly right, and everything else appears to be wrong;-) I think the philosophy for not introducing a decr command analog to incr was that incr <varname> -<increment> does the same job, and makes the language smaller. A smaller language may be better readable than a bloated one, because the reader can more easily have full grasp of the language. On the other hand, you extend the language everytime you write a proc... The tradeoff between personal requirements (which might lead one to write a decr proc) and simplicity (which tries to avoid too many extensions to the language, and also has to do with efficiency) has to be part of every design decision. I prefer (of course) shorter code without many extensions. When I started Tcl, I was very proud that I could create language elements like lassign, to spread a list to scalar variables, but over time I've come to think that

 foreach {a b c} $list break

is readable (if one knows how to read it) and standard Tcl, while

 lspread $list to a b c

(that's how my version looked) requires either reading or "intuiting" the definition of lspread, one costing time, the other possibly misunderstandings, so I don't do such things no more.