[swift-evolution] Support for assertions/preconditions that sometimes fail.

Saagar Jha saagar at saagarjha.com
Sat Jan 14 19:00:03 CST 2017


Why not just add a // TODO or // FIXME comment?

Saagar Jha

> On Jan 14, 2017, at 4:10 PM, Amir Michail via swift-evolution <swift-evolution at swift.org> wrote:
> 
> It’s quite common for an assertion/precondition that you thought should hold actually does not yet there is no bug. In that case, you might want to remind yourself of this fact by commenting out the assertion/precondition (instead of deleting it) so that you don’t make the same mistake in the future by inserting such assertions/preconditions into the code.
> 
> However, it would be nice to have explicit support for assertions/preconditions that don’t always hold where there is no bug.
> 
> For example:
> 
> preconditionNotAlwaysTrue( list.isEmpty )
> 
> When your app finishes running, the IDE could show you all such preconditions/assertions that you thought fail sometimes that did not fail in that particular run. In that case, you might consider switching them to normal preconditions/assertions provided your code has now evolved to the point where they always hold.
> _______________________________________________
> swift-evolution mailing list
> swift-evolution at swift.org
> https://lists.swift.org/mailman/listinfo/swift-evolution

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


More information about the swift-evolution mailing list