It was in the previous proposal and suggested that you are not trying to shadow the previous variable, but trying to unwrap it - and it acts as unwrapped from there on.
> On Jun 23, 2016, at 8:52 PM, Tim Vermeulen <[email protected]> wrote: > > Why with the exclamation mark? It suggests you’re force unwrapping something. > >>> On Jun 23, 2016, at 8:45 PM, Tim Vermeulen via >>> swift-evolution<[email protected]>wrote: >>> >>> I would love to be able to do something like >>> >>> doSomething(with: myOptional?) >> This actually looks good to me, though if I were a newcomer to the language, >> it would be really cryptic. >> >> In case the function returned any value, it could become an optional, just >> like with try?... >> >> I still, however, prefer the original proposal of if let myOptional! { >> doSomething(myOptional) }... >> >>> >>> which would be equivalent to >>> >>> if let myValue = myOptional { >>> doSomething(with: myValue) >>> } >>> >>> But it’s been discussed here before, and I don’t think people were very >>> enthusiastic about it. >>> >>>> I was wondering if people would be open to adding an unwrap method to the >>>> Optional type,I already have a method like this which shortens code for me. >>>> >>>> So this: >>>> >>>> let myReallyLongOptionalName: String? = "Hey" >>>> >>>> if let string = myReallyLongOptionalName { >>>> doSomethingWith(string) >>>> } >>>> >>>> Could become" >>>> >>>> let myReallyLongOptionalName: String? = "Hey" >>>> >>>> myReallyLongOptionalName.unwrap { >>>> doSomethingWith($0) >>>> } >>>> >>>> The block would only be fired if myReallyLongOptionalName has a value. >>>> >>>> >>>> ___________________________________ >>>> >>>> >>>> James⎥Head of Trolls >>>> >>>> >>>> [email protected](mailto:[email protected])⎥supmenow.com(http://supmenow.com) >>>> >>>> >>>> Sup >>>> >>>> >>>> Runway East >>>> >>>> >>>> 10 Finsbury Square >>>> >>>> >>>> London >>>> >>>> >>>> EC2A 1AF >>> _______________________________________________ >>> swift-evolution mailing list >>> [email protected] >>> https://lists.swift.org/mailman/listinfo/swift-evolution >> >> _______________________________________________ swift-evolution mailing list [email protected] https://lists.swift.org/mailman/listinfo/swift-evolution
