[swift-evolution] Shorthand unwrap proposal

Vladimir.S svabox at gmail.com
Fri Jun 24 04:14:27 CDT 2016


On 23.06.2016 19:26, Dmitri Gribenko via swift-evolution wrote:
> On Thu, Jun 23, 2016 at 9:25 AM, James Campbell via swift-evolution
> <swift-evolution at swift.org> wrote:
>> So if the function I run inside of the map has a return value of Void will
>> that still compile ?
>
> Yes.

Btw, in case of

let s: String? = "hi"
s.map {print($0)}

we have
warning: result of call to 'map' is unused
s.map {print($0)}

Isn't it strange that result of call is Void, but we have a warning? Don't 
we need to suppress warning in this case?

Otherwise we need to write boilerplate code:
_ = s.map {print($0)}

>
> Dmitri
>


More information about the swift-evolution mailing list