Sent from my iPad

> On Jan 22, 2017, at 3:15 PM, Chris Lattner <clatt...@nondot.org> wrote:
> 
> 
>>> On Jan 20, 2017, at 12:22 PM, Dave Abrahams via swift-evolution 
>>> <swift-evolution@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.

It would be useful to know the technical definition of "structured." The fact 
is that there's a large category of sensible goto-like jumps that we probably 
want to allow and I see no advantage to giving them all distinct names.  I 
don't believe users will distinguish them.  We already have "break looplabel" 
and, aside from the label being in the wrong place, it's effectively a goto.  
It seems to me we should just have goto and either prohibit the troublesome 
uses or give them reasonable semantics.

I could live with "break" as well as "goto", but it feels a bit like it's 
pretending to be something it isn't, and there's the source compatibility 
problem with the label position.

-Dave
_______________________________________________
swift-evolution mailing list
swift-evolution@swift.org
https://lists.swift.org/mailman/listinfo/swift-evolution

Reply via email to