@kyleve: I love that pattern. I used to do `id foo; { …; foo = …; }`, but blocks make it way easier to understand and encapsulate the work.
-
-
-
@numist Yeah; that’s one reason I prefer the blocks. Causes less “what does this do” from others.
-
-
-
@kyleve there's a syntax to do this in C that doesn't greater a block, but I never remember it and#prematureoptimizations anyway -
- View other replies
-
- View other replies
-
-
@nicklockwood@Javi Didn’t even notice that :-) -
- View other replies
-
@nicklockwood@kyleve@Javi You need parens. -
- Show more
-
-
-
@kyleve You can also do ({…; retVal}) but maybe this is more clear. - View other replies
-
@zacwest That’s one reason I do it this way; much more clear.
-
-
-
@kyleve var = ({ NSObject *obj = http://NSObject.new ; ... obj; }); is more optimized -
@romaonthego Lots of things are more optimized than other things; understandability for coworkers is more top of mind for me. - Show more
-
-
@kyleve Interesting. And I guess you could "return" early if there's an error or to get out of a loop. -
@kyleve You could also omit the ^, explicit return, and () and wind up with the same result. -
@kyleve I only use blocks if I need it to be an expression `id foo; { id bar; foo = bar.baz }` -
@kyleve beautiful really. -
@kyleve cute. I’ll be using that one!
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.
Kyle
Scott
Javi
Nick Lockwood
Decorative Jord
Zac West
Roman Efimov
Michael Tsai
Mark Adams
Heath Borders
Dan Bostonweeks
Michael Gorbach