[Issue 199] Label causes scope to collapse into parent

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed May 29 10:17:41 PDT 2013


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



--- Comment #18 from monarchdodra at gmail.com 2013-05-29 10:17:39 PDT ---
(In reply to comment #17)
> (In reply to comment #10)
> > According to this talk:
> > http://forum.dlang.org/thread/ohctkdnupmbprglobwtc@forum.dlang.org#post-axonofactkyzpagilcbm:40forum.dlang.org
> > The spec does NOT state it should work that way.
> 
> Yes it does, as I quoted in comment 5.
> 
> LabeledStatement:
>     Identifier : NoScopeStatement

That was my statement :D but it was rebuked by Ali in comment 7 that:

It is still a bug because NoScopeStatement does not mean "expand into 
current scope." It means "do not introduce a scope" and clearly allows 
blocked statements:

NoScopeStatement:
    ;
    NonEmptyStatement
    BlockStatement


> (In reply to comment #16)
> > (In reply to comment #15)
> >> Walter Bright, comment #6:
> >>> I don't want to change this because it could break existing code
> >> 
> >> We could deprecate having a BlockStatement after a label, with a message
> >> suggesting to move the label within the block. That way no code gets broken.
> > Wait. What? Deprecate having a block statement after a label? Why would we do
> > that? That's completely arbitrary. Plus, that would *definitely* break more
> > code than what we'd break with a straight up fix.
> 
> My inkling is that, compared with the amount of code it would break, it would
> cause far more code that was already broken to generate a compiler error.

Isn't "code that was broken now generates a compiler error" good though...?

I still maintain that the amount of use case in nature is probably trivially
low. Of those, the amount it would break even lower. I have no proof, but D is
modern, and modern tends to stay clear away of goto and labels anyways.

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