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

Amir Michail a.michail at me.com
Tue Dec 8 17:42:07 CST 2015


> On Dec 8, 2015, at 6:34 PM, Jordan Rose <jordan_rose at apple.com> wrote:
> 
> 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.

I think “assert" should be removed from the language.

> 
> 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