[swift-evolution] Proposal: Replace labels with keywords and "*" suffixes

Amir Michail a.michail at me.com
Thu Dec 10 08:25:42 CST 2015


> On Dec 10, 2015, at 8:54 AM, Kevin Wooten <kdubb at me.com> wrote:
> 
>> 
>> On Dec 10, 2015, at 6:47 AM, Amir Michail <a.michail at me.com <mailto:a.michail at me.com>> wrote:
>> 
>> 
>>> On Dec 10, 2015, at 8:45 AM, Adrian Kashivskyy <adrian.kashivskyy at me.com <mailto:adrian.kashivskyy at me.com>> wrote:
>>> 
>>>> What “break" currently does can be unclear. For example, “break” without a label in do {…} doesn’t just break out of the do.
>>> 
>>> Because `do` isn't a loop.
>> 
>> Neither is a case but the “break" behaviour is different.
>> 
>> Moreover, you can give do a label to just break out of the do.
>> 
> 
> 
> As you just said if you think “break” behavior is unclear, you can add a label.

The point is that Swift currently has inconsistent break behaviour. 

> 
> It doesn’t seem to be up for debate that labels provide much more clarity than your proposal. To reduce clarity because you find it annoying to come up with label names is not consistent with the design of the language; which clearly favors clarity.
> 
> 
>>> 
>>> 
>>> Pozdrawiam – Regards,
>>> Adrian Kashivskyy
>>> 
>>>> Wiadomość napisana przez Amir Michail via swift-evolution <swift-evolution at swift.org <mailto:swift-evolution at swift.org>> w dniu 10.12.2015, o godz. 14:28:
>>>> 
>>>> 
>>>>> On Dec 10, 2015, at 8:20 AM, Kevin Wooten <kdubb at me.com <mailto:kdubb at me.com>> wrote:
>>>>> 
>>>>> Curios as to what you see the advantage of this is, over labels? Seems to me it only saves a few keystrokes at the expense of clarity.
>>>> 
>>>> What “break" currently does can be unclear. For example, “break” without a label in do {…} doesn’t just break out of the do.
>>>> 
>>>> Also, I really don’t like coming up with label names. They tend to be uninteresting.
>>>> 
>>>>> 
>>>>> Given the stated goals of Swift I don’t imagine this would be an interesting proposal for many.
>>>>> 
>>>>>> On Dec 10, 2015, at 5:59 AM, Amir Michail via swift-evolution <swift-evolution at swift.org <mailto:swift-evolution at swift.org>> wrote:
>>>>>> 
>>>>>> For example:
>>>>>> 
>>>>>> for* … {
>>>>>> for** ... {
>>>>>>  for ... {
>>>>>>>>>>>>    if … { break for* }
>>>>>>    ...
>>>>>>    if … { continue for** }
>>>>>>    ...
>>>>>>  }
>>>>>> }
>>>>>> }
>>>>>> 
>>>>>> repeat {
>>>>>> do {
>>>>>>  for … {
>>>>>>    if … { break do }
>>>>>>    if … { continue repeat }
>>>>>>  }
>>>>>>>>>>>> }
>>>>>> } while …
>>>>>> 
>>>>>> 
>>>>>> _______________________________________________
>>>>>> swift-evolution mailing list
>>>>>> swift-evolution at swift.org <mailto:swift-evolution at swift.org>
>>>>>> https://lists.swift.org/mailman/listinfo/swift-evolution <https://lists.swift.org/mailman/listinfo/swift-evolution>
>>>>> 
>>>> 
>>>> _______________________________________________
>>>> swift-evolution mailing list
>>>> swift-evolution at swift.org <mailto:swift-evolution at swift.org>
>>>> https://lists.swift.org/mailman/listinfo/swift-evolution <https://lists.swift.org/mailman/listinfo/swift-evolution>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20151210/e5f64d93/attachment.html>


More information about the swift-evolution mailing list