[swift-evolution] Proposal: remove "assert" and always use "precondition" instead.
sune.foldager at me.com
sune.foldager at me.com
Mon Dec 14 17:09:27 CST 2015
> On 15 Dec 2015, at 00:01, Amir Michail via swift-evolution <swift-evolution at swift.org> wrote:
>
> What about these renamings?
>
> assert => debugAssert
>
> precondition => assert
I think precondition is a better name because it clearly expresses that this is an expected precondition for calling the method. Precondition is similar to Microsoft code contract’s Contract.Requires.
Also, the traditional use of assert (also in other languages) is for guarding against your own programmer errors, which I think most people expect when they see assert. It may be useful for an assert that’s still active in optimised builds, true. I guess that could be called assert! or assertAlways.
-Sune
More information about the swift-evolution
mailing list