Yep, "logic" failures are not supposed to be there if not for avoiding checks 
that could worsen performance in pieces of code that should run as fast as 
possible. I like Adrian's solution because it doesn't add a new operator to the 
standard library, something that could mean one more encouragement to force 
unwrap things.

About preconditions, Cocoa with Love's Matt Gallagher wrote an article some 
months ago on partial functions, why you should avoid them and how to do so: 
it's a very interesting read 
http://www.cocoawithlove.com/blog/2016/01/25/partial-functions-part-one-avoidance.html
 
<http://www.cocoawithlove.com/blog/2016/01/25/partial-functions-part-one-avoidance.html>


Elviro

> Il giorno 28 giu 2017, alle ore 07:02, Yuta Koshizawa via swift-evolution 
> <[email protected]> ha scritto:
> 
> ...
> 
> Logic failures are intended to be handled by fixing the code. It means
> checks of logic failures can be removed if the code is tested enough.
> Actually checks of logic failures for various operations, `!`,
> `array[i]`, `&+` and so on, are designed and implemented to be removed
> when we use `-Ounchecked`. It is useful for heavy computation like
> image processing and machine learning in which overhead of those
> checks is not permissible.
> 
> So I think checks for `!!` should be removed with `-Ounchecked` as well.
> 
> --
> Yuta
> 

_______________________________________________
swift-evolution mailing list
[email protected]
https://lists.swift.org/mailman/listinfo/swift-evolution

Reply via email to