Re: Blocks with return type
Re: Blocks with return type
- Subject: Re: Blocks with return type
- From: Quincey Morris <email@hidden>
- Date: Sat, 29 Sep 2012 21:11:53 -0700
On Sep 29, 2012, at 20:55 , Kyle Sluder <email@hidden> wrote:
> I wasn't aware this was accepted syntax. I was under the impression that you either had to explicitly case the return value or explicitly cast the block literal.
I believe it's official syntax. It's not (quite) documented in the developer documentation, but I assume it's in the clang docs somewhere. Here's an actual line of code, as a more familiar example:
NSIndexSet* selectedIndexes = [listView.selectedRowIndexes indexesPassingTest: ^BOOL (NSUInteger rowIndex, BOOL* stop) {…}
I'm not sure it's worth letting the compiler figure out the return type, and casting is always a potential bug because it always suppresses a compile time type check.
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden