[swift-evolution] guard let x = x
Tino Heth
2th at gmx.de
Wed Nov 2 11:53:33 CDT 2016
Imho it would be better not to add "uwrap".
Yes, it might be nicer in some situations, but it is also nice to have a simple (or at least less complicated) language.
For me, the actual benefit is to low to justify a separate keyword which creates questions that don't exist with the current syntax.
It is quite clear that "if let" declares a new value, whereas "unwrap" introduces ambiguity.
Have a look at this line:
if unwrap someObject.someFunction() { print("?") }
Should the compiler accept it?
If yes: Should it be possible to access the return value of someFunction? How?
If no: What about "someObject.someComputedProperty"? What if you exchange "someObject" with "self"?
What if I want to modify an unwrapped value? "if var" is quite intuitive, but unwrap… maybe it depends on the original value, or is there a second variant?
There might be good answers for all those questions, but they aren't obvious.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20161102/9f8f63b6/attachment.html>
More information about the swift-evolution
mailing list