Subj : Re: Is well written code a rare species ? To : comp.programming From : akarl Date : Tue Aug 16 2005 03:02 am Joe Butler wrote: >>I'd write your example as: >> >>for (x=0, y=0; x < n; x++, y++) >>{ >>} >> > > > I could easily live with that, but just got into the habit of 'attaching' > the assignment operator to the assignee. > And separating both 'things' (can't recall their tecky name) with spaces > during a comparison, e.g. if(x == 0). It's another visual clue that makes > these things stand out to me - I don't need to think about it when I'm > typing it, it just happens. > > I guess that x= 0 is not as symetrical as x == 0 (which is how I visuallise > the entire thing in my mind - the equivalence is ballanced and could be > reversed with no change in meaning: so, symetrical, wherease the assignment > changes meaning if reversed - therefore: not symetricall). x = 0 makes me > look twice because the symbol in the middle is too short to be there on its > own. > And seeing the 'for' with a space after it, I always wonder how people that > were brought up during maths lessons on f(x) rather than f (x) [I assume all > maths teaches this layout - i.e. no space after the 'f'] end up writing > 'functions' as function (x) rather than function(x) with no space. It's > only a very minor thing, but it makes me wonder, anyway. > > e.g. > > sin(x) > sin (x) > > one is natural, the other is somehow disjointed for me. I can inform you that the keyword `for' is the start of a control statement and not a function call, hence the very reason for putting a space after `for', `while' and `if', to make it look less like a function call. (The parentheses around the guard are only there to simplify lexical scanning.) August .