[swift-evolution] Proposal: remove "assert" and always use "precondition" instead.

Amir Michail a.michail at me.com
Tue Dec 8 18:00:37 CST 2015


> On Dec 8, 2015, at 6:59 PM, Adrian Kashivskyy <adrian.kashivskyy at me.com> wrote:
> 
> That's a choice I would have to carefully make when designing the behavior. Not all asserts are non-recoverable.
> 

You could have precondition raise an exception so you can catch it if you really want to.

> Pozdrawiam – Regards,
> Adrian Kashivskyy
> 
>> Wiadomość napisana przez Amir Michail <a.michail at me.com <mailto:a.michail at me.com>> w dniu 09.12.2015, o godz. 00:56:
>> 
>> 
>>> On Dec 8, 2015, at 6:55 PM, Adrian Kashivskyy <adrian.kashivskyy at me.com <mailto:adrian.kashivskyy at me.com>> wrote:
>>> 
>>> Strong -1, `assert` is a great tool for catching programmer errors in development phase, without compromising the stability in release mode.
>> 
>> You would rather have an ill-defined state rather than a crash with a useful bug report?
>> 
>>> 
>>> Pozdrawiam – Regards,
>>> Adrian Kashivskyy
>>> 
>>>> Wiadomość napisana przez Amir Michail via swift-evolution <swift-evolution at swift.org <mailto:swift-evolution at swift.org>> w dniu 09.12.2015, o godz. 00:52:
>>>> 
>>>> Swift is a safe language after all. Moreover, it is all too easy to accidentally type “assert” when you mean “precondition”.
>>>> _______________________________________________
>>>> swift-evolution mailing list
>>>> swift-evolution at swift.org <mailto:swift-evolution at swift.org>
>>>> https://lists.swift.org/mailman/listinfo/swift-evolution <https://lists.swift.org/mailman/listinfo/swift-evolution>
>>> 
>> 
> 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20151208/e6bafaf7/attachment.html>


More information about the swift-evolution mailing list