> On May 29, 2015, at 11:02 AM, Alex Zavatone <z...@mac.com> wrote: > > Regarding Daniel's next email, yeah, I kind of really dislike the extra > indent for the entire init function. It just seems so wrong.
That’s sort of a religious issue. Some people think early returns from functions are wrong, because they make the flow of control less structured. (Pascal doesn’t have a ‘return’ statement at all, at least none of the dialects I ever used.) IIRC some functional languages don’t support early-return either. I tend to prefer early returns, but at the same time I agree that they are sometimes confusing, especially for someone reading a function for the first time. FWIW, the Google style guide says to use early returns for quick-reject tests at the start of a function, which is what we’re talking about here. On the other hand, the structure of an Obj-C ‘init’ method is such a well-known idiom that I’m reluctant to mess with it. Everyone knows how control flows in a normal init method, so if they se one that doesn’t look like that, it takes a bit longer to figure out what’s going on. Not to mention that putting assignments in ‘if’ statements is EVIL, even if it does save you a line of code. —Jens _______________________________________________ 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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com