From: Donal K. F. <don...@ma...> - 2006-11-06 10:52:03
|
Larry McVoy wrote: > For what it is worth, we have 8+ years of usage and we do horrible things > like [...] I used to do that sort of thing quite a lot, but nowadays I try to write code that never puts an assignment in an if/while if possible since that leads to much greater clarity during maintenance. Saving a source line isn't worth it; newlines are cheap. :-) (I have an exception where I'm writing a macro that builds different functionality that isn't in base C and which needs an assignment in a funny place to work correctly. But in that case I'll also write a comment at the definition that explains what dirty tricks I'm up to.) > I think this is a newbie error that simply doesn't happen with pros. It's rare, but only because many people have learned to be paranoid about it. Using ":=" instead (which has a pretty good pedigree as well) means that forgetfulness won't lead to strange bugs. Also, Tcl's not just used by pros. Let's be kind to newcomers to the big world of programming too. Noobs make some *horrible* blunders in "intro to C" classes, and they're quite common among Java programmers too (though they're usually caught by the tighter type system there). By contrast, languages that use the Algol-derived ":=" don't have this problem at all. Mixing the symbols up is a syntax error, and so gets caught by people early. Donal. |