www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 13526] New: Allow statement: with(auto p = new Panel())


          Issue ID: 13526
           Summary: Allow statement: with(auto p = new Panel())
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Windows
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: DMD
          Assignee: nobody puremagic.com
          Reporter: andre s-e-a-p.de

Currently this code is not accepted:

with (auto p = new Panel())
    parent = this;
    text = "bla";
    with (new Button())
        parent = p; // Here p is needed
        text = "bla2";

auto is not allowed in with statement. p is needed as parent attribute
of the new button.
One workaround would be to change the coding to:

Panel p;
with (p = new Panel()) {...}

While this coding is working, it seems like a missing feature auto 
is not working. 

Could you check?

In the discussion
http://forum.dlang.org/thread/alaqjnmfckedhuvypvps forum.dlang.org
also someone mentioned auto would make sense in switch,
but can't judge on that.

Sep 24 2014