[swift-evolution] Proposal: Remove the "fallthrough" keyword

Chris Lattner clattner at nondot.org
Sun Jan 22 17:15:43 CST 2017


> On Jan 20, 2017, at 12:22 PM, Dave Abrahams via swift-evolution <swift-evolution at swift.org> wrote:
> 
>> 
>> Yeah, maybe there's a more general language feature that could replace 'fallthrough' here. Instead
>> of labelling cases, we could support a 'reswitch' statement that redispatches the switch to the case
>> matching the operand:
>> 
>>    switch some_value {
>>    case .REFINED:
>>        if !validate(some_value) { return NULL }
>>        reswitch .BASE
>> 
>>    case .BASE:
>>        handle_enum_value();
>>    }
> 
> We should just call a spade a spade and spell that "goto" ;-)

Goto has traditionally been used for unstructured control flow, but this form is still fully structured.  You cannot produce irreducible loops, jump into scopes, over declarations, etc.

-Chris
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20170122/287c76d6/attachment.html>


More information about the swift-evolution mailing list