www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 14316] New: allow to declare a variable in with statement

https://issues.dlang.org/show_bug.cgi?id=14316

          Issue ID: 14316
           Summary: allow to declare a variable in with statement
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: DMD
          Assignee: nobody puremagic.com
          Reporter: code dawg.eu

Similar to the exception for the if statement, it would be very convenient to
allow variable declaration in the with statement, so that a new value can be
initialized and returned.

----
with (auto settings = new HTTPServerSettings)
{
    port = 8080;
    bindAddresses = ["127.0.0.1"];
    return settings;
}
----

--
Mar 21 2015