break while; break for; break foreach

tsbockman thomas.bockman at gmail.com
Fri May 14 01:00:38 UTC 2021


On Friday, 14 May 2021 at 00:58:45 UTC, tsbockman wrote:
> On Thursday, 13 May 2021 at 20:14:45 UTC, sighoya wrote:
>> On Thursday, 13 May 2021 at 19:36:28 UTC, Steven Schveighoffer 
>> wrote:
>>> The problem I've had with it is that a label cannot be 
>>> repeated within a function, so it's hard to write generic 
>>> code which requires this feature.
>>
>> Can't this be relaxed in some way?
>
> Yeah, why not just apply the same scoping rules to labels as 
> apply to variables? This would be a non-breaking change. 
> (Undoing the change later would not be, though.)

Well, not the same rules, I guess - since it's currently possible 
to `goto` from one scope to another. But, there could be a rule 
that says that a label "bubbles up" to the most outer scope 
inside the current function where it won't conflict with anything 
else.


More information about the Digitalmars-d mailing list