[swift-evolution] allowing to specify optionality with type inference
erica at ericasadun.com
Thu Mar 31 09:21:35 CDT 2016
> On Mar 24, 2016, at 4:22 AM, Hugues Bernet-Rollande via swift-evolution <swift-evolution at swift.org> wrote:
> var a:String? = String()
> // or
> var b = String() as String?
> // or
> var c:Optional<String> = String()
When I need to force an optional (primarily for sample code) I can do this already:
var myOptionalString = Optional("")
In this example, `myOptionalString ` picks up the type as well as the optionality.
Does this not meet your requirement of "Allowing to specify only the optionality part of
a variable type while still having the actual wrapped type infered by the assignement" in existing
Beyond that, can you offer any compelling use-cases that motivate this change?
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the swift-evolution