[Issue 199] Label causes scope to collapse into parent

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu May 30 09:42:04 PDT 2013


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



--- Comment #30 from monarchdodra at gmail.com 2013-05-30 09:42:02 PDT ---
(In reply to comment #29)
> (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.

I understand your position, but deprecation really implies that something WILL
be removed, and usage NEEDS to stop. Having something permanently deprecated is
not tenable: there is a compile mode that makes deprecated calls errors, and
here, it is not an error.

In particular, since there are builders out there that compile with
"deprecation is error", well end up breaking *valid* code, when trying to avoid
not breaking broken code :/

> > 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?

That is a very good question :D

--------
Aren't we getting ahead of ourselves though? I think we should first
concentrate on getting the spec changed, or at least, get Walter to agree that
the current spec is not rational ?

Well, maybe he can be better persuaded if we present a non-breaking fix...

-- 
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