[swift-evolution] Optional precondition after else and #else

Jordan Rose jordan_rose at apple.com
Tue Dec 8 17:34:32 CST 2015


My first thought was that at first glance I'd get this confused with "else if". Obviously that doesn't change semantics in correct code, but it does seem a little subtle.

My second thought was "precondition or assert?" (i.e. "is the check enabled in release builds?") and that convinced me that this wasn't really worth the added complexity. It's a neat idea, but I think the language becomes more complex because of it without sufficient gain.

Jordan

> On Dec 8, 2015, at 5:47, Amir Michail via swift-evolution <swift-evolution at swift.org> wrote:
> 
> For example:
> 
> if a > 0 {
> ….
> } else a < -5 {
>> }
> 
> This would be the same as:
> 
> if a > 0 {
> ….
> } else {
>  precondition(a < -5)
>> }
> 
> _______________________________________________
> swift-evolution mailing list
> swift-evolution at swift.org
> https://lists.swift.org/mailman/listinfo/swift-evolution



More information about the swift-evolution mailing list