[Issue 199] Label causes scope to collapse into parent

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu May 30 09:29:05 PDT 2013


http://d.puremagic.com/issues/show_bug.cgi?id=199



--- Comment #29 from Nick Treleaven <ntrel-public at yahoo.co.uk> 2013-05-30 09:29:04 PDT ---
(In reply to comment #28)
> (In reply to comment #27)
> > It's a trade off between either breaking working code or annoying users with
> > deprecation messages that need small fixes to their code.
> 
> Just seems that because something is broken, your solution is to simply
> deprecate the entire feature. There is no reason to make labeling a block
> illegal or deprecated.
> 
> The correct solution would be to find a path that doesn't break code, but still
> marks invalid code as such, and give users a pre-emptive chance to fix the
> code, before it is definitely banned.

I didn't advocate banning it. I advocate permanent deprecation, because the
semantics are bug prone, and we should (arguably) never risk *silently*
breaking working code. There is no reason to remove it for a long time,
possibly never.

> The (imo correct) path is that the NoScopeStatment should still provide no
> scope, but emit a deprecated message if anything declared in the scope is used.
> EG:
> 
> void main()
> {
>     label:
>     {
>         int i;
>     }
>     writeln(i); //(1)
> }
> 
> (1) should emit a deprecation message.

Sounds good. Can it be implemented easily?

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list