[swift-users] Compiler can't infer map transfer closure return type?
erica at ericasadun.com
Mon Mar 7 19:37:30 CST 2016
> On Mar 7, 2016, at 6:24 PM, Jordan Rose <jordan_rose at apple.com> wrote:
>> On Mar 7, 2016, at 17:21, Erica Sadun <erica at ericasadun.com <mailto:erica at ericasadun.com>> wrote:
>>> On Mar 7, 2016, at 6:15 PM, Jordan Rose via swift-users <swift-users at swift.org <mailto:swift-users at swift.org>> wrote:
>>> Today there's at least a simple rule: if the closure consists of a single expression (or a single return statement), the compiler will look at the body; otherwise it won't.
>> Would it be so hard to have a rule that if there's an unambiguous expression as the last line of a closure that
>> it automagically acts as a default warn-on-unused-result return? So many of my two-line closures would
>> benefit from this.
> What does that mean? You can't see how the closure is being called, so how do you know if the result is used or unused?
Would it be so hard to have a rule when there's an unambiguous expression as the last line of a closure that
it automagically acts as a default return? So many of my two-line closures would benefit from this.
-- E, clarifying
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the swift-users