[swift-evolution] Proposal: Initialization should not be required in precondition(false) case.
a.michail at me.com
Fri Feb 12 11:27:48 CST 2016
> On Feb 12, 2016, at 12:23 PM, Chris Lattner <clattner at apple.com> wrote:
>> On Feb 12, 2016, at 9:15 AM, Amir Michail via swift-evolution <swift-evolution at swift.org> wrote:
>>> On Feb 12, 2016, at 12:09 PM, Radosław Pietruszewski <radexpl at gmail.com> wrote:
>>> I think what you mean is `fatalError()`.
>>> You can’t do what you suggest, because you can’t prove that the expression passed to precondition will evaluate to false. (You theoretically could if the compiler checked for you passing `false`, but that makes no sense. Just go with `fatalError` or `preconditionFailure`.)
>> What’s wrong with having the compiler explicitly check for “false”?
> Weird special cases make the compiler less predictable.
True, but not having them requires deeper knowledge of the standard libraries.
In practice, just checking for “false” would solve this problem.
More information about the swift-evolution