> Actually, I couldn't agree more with the documentation!

Funny thing is, although I've used the style he advocates for a very long
time (15 years???), I don't agree with his reasoning.

Indentation of *code* should be consistent, an object comes into scope where
it's declared, not at an opening brace, and goes out of scope at the closing
brace, which should be obvious by indentation less than the code it
encloses. In other words, the code -> closing brace transition is important,
but not the opening brace -> code transition (for statements are arguably an
exception, but even there, I don't think the opening brace position
matters).

Thing is, I remember why I switched all those years ago. It had to do with
narrow lines on terminal screens, and what happens when a line of code is a
tiny bit too long to fit, and the struggle to balance larger indentation
size for scannability against smaller indentation size to avoid running off
the right edge. The style advocated both made pairings easier to see with
narrower indentation, because {} are rather vertical and line up better
visually than some-other-character and }, and because it was highly unlikely
that a { would be hiding just off the right-hand edge of the screen.

Thing is none of those reasons apply with modern tools, and frankly I've
slowly come to prefer K&R style. That's right, I use the alternate every day
because of the massive amount of code I have in it, but I find that I
actually prefer to read K&R style in an IDE with code folding & so on. I
think what it is, is that on a large screen, I prefer not having a nearly
blank line between a block's opening expression (for, while, if...) and its
body. I can see a lot more code at once now, and I prefer that whitespace
breaks it into associated chunks vertically, and on a large monitor, a line
with a single { character might as well be a blank line.

Anyways, it really is a personal preference. All arguments I've ever seen
that try to claim one style or the other is more correct or safer, are B.S.
(Including the one referenced--the bounds of a block were *ALWAYS*
absolutely vitally important, well before objects & destructors. You sure as
heck don't need to care about destructors in order to care about whether or
not a line of code is within the body of a block!)

> As a matter of
> fact, when I take over someone else's code, the first thing I do is
> spend the time needed (however much required) to rearrange the position
> of the braces to conform with the documented style indicated in the
> above references.

Me too, but I think I'm going to quit ;-)

-- 
Scott Ribe
[EMAIL PROTECTED]
http://www.killerbytes.com/
(303) 722-0567 voice


_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to