[Issue 14316] New: allow to declare a variable in with statement

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Sat Mar 21 17:53:57 PDT 2015


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 at puremagic.com
          Reporter: code at 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;
}
----

--


More information about the Digitalmars-d-bugs mailing list