Re: inference of block return type
Re: inference of block return type
- Subject: Re: inference of block return type
- From: Matt Neuburg <email@hidden>
- Date: Mon, 28 Jun 2010 20:01:44 -0700
- Thread-topic: inference of block return type
On Mon, 28 Jun 2010 15:12:23 -0700, Bill Bumgarner <email@hidden> said:
>This document does demonstrate declaring a return type, but only in the context
of a typedef or block variable declaration (and not for a block literal):
>
>http://developer.apple.com/iphone/library/documentation/Cocoa/Conceptual/Blocks
/Articles/bxDeclaringCreating.html
Correct, and that's the problem I'm talking about. There are no examples on
that page of "^ ReturnType".
>The "Using Blocks" also shows declaring a return type, but only on the type
definition and not on a block literal.
Correct. There are no examples on that page of "^ ReturnType". Indeed, the
example in "Using a Block as a Method Argument" apparently cheats by
declaring the block's type as a separate step, totally unnecessarily (since
the type is already defined by the declaration of
indexesOfObjectsPassingTest). It's almost as if the author of the example
didn't understand the syntax either.
>Many of the examples in "A Short Practical Guide To Blocks" also show declaring
a block with an explicit return type:
>
>http://developer.apple.com/iphone/library/featuredarticles/Short_Practical_Guid
e_Blocks/
And not a one of them shows "^ ReturnType". It isn't even mentioned as being
possible, or possibly needed; au contraire, it comes right out and says
"When specifying your block, begin with a caret (^) and the parenthesized
argument list", skipping merrily past the return type and indeed apparently
telling you NOT to use one.
>I've filed <rdar://problem/8138925> asking for the documentation to treat the
block literal syntax in detail
Thanks a bunch for filing that. On an important technical matter like this,
the failure to just state the bald rules of the syntax is a positive
disservice. m.
--
matt neuburg, phd = email@hidden, <http://www.tidbits.com/matt/>
A fool + a tool + an autorelease pool = cool!
AppleScript: the Definitive Guide - Second Edition!
http://www.tidbits.com/matt/default.html#applescriptthings
_______________________________________________
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