It's a -1 for me. I don't think I have any new arguments to add, but I'll reiterate the reasons already mentioned above that convinced me:
Is the problem being addressed significant enough to warrant a change to Swift?
I believe that it is, but the proposed alternative of making Never
a bottom type (something which I believe is worth doing anyway regardless of this specific use case) or providing an overload of ??
with a signature of (lhs: T?, rhs: Never) -> T
both seem like better solutions than the introduction of a new operator.
I like the ??
solution because it's what I would expect to work if I didn't know anything about the Never
type and its limitations. If I came across let foo = bar ?? fatalError("...")
, I'd immediately understand what was going on.
The objection that this solution doesn't work the same way if you use assertionFailure()
or preconditionFailure()
makes no sense to me because it works exactly the same way as if you used those functions inside a guard
statement, which is what this feature is sugar for anyway. If anything it's a ding against the !!
operator that it doesn't provide the same granularity of control over how the assertion is handled that fatalError()
and preconditionFailure()
do.
I think a good way to look at it is: If Never
was already a bottom type, and so foo ?? fatalError("")
already worked, would there still be a significant incentive to add the !!
as well, or would we already consider this a solved problem?
Does this proposal fit well with the feel and direction of Swift?
I don't believe it does. Nowhere else in Swift is an operator used in this way, and I don't think that the proposed !!
has the same relationship to ??
that !
does to ?
- it's not symmetrical.
If you have used other languages or libraries with a similar feature, how do you feel that this proposal compares to those?
n/a
How much effort did you put into your review? A glance, a quick reading, or an in-depth study?
I read the full proposal and most of the discussion.