[swift-evolution] Proposal: Replace ?? by an (optional) argument to ?
cacoyi at gmail.com
Mon Jan 25 21:05:22 CST 2016
I agree with Rob, also I prefer it without excessive brackets, brackets
tend to get mismatched because you have to go hunting for the start or end
of the expression:
a ?? b ?? c ? d
I think it makes chaining cleaner and clearer.
Granted the first expression is longer, but this isn't true with styles
that require whitespace inside the brackets. Did you notice that each
expression had a mistake?
On Tue, Jan 26, 2016 at 1:52 PM, Rob Mayoff via swift-evolution <
swift-evolution at swift.org> wrote:
> `x?(false)` already has a meaning. If `x` is of type `Optional<(Bool) ->
> ()>`, then `x?(false)` means “if x is None, do nothing; if x is Some(f),
> call f(false)”.
> I don't think the end is "the most important position", and I don't think
> the default value is necessarily "the least important part of the
> I like the existing ?? operator more than this idea.
> swift-evolution mailing list
> swift-evolution at swift.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the swift-evolution