[Issue 17265] WithStatement: Find better Example for what "with" really does

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun Dec 10 15:53:51 UTC 2017


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

Stefan <kdevel at vogtner.de> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
         Resolution|FIXED                       |---

--- Comment #4 from Stefan <kdevel at vogtner.de> ---
The false assertion 

"with (expression)
{
    ...
    ident;
}

is semantically equivalent to: 

{
    Object tmp;
    tmp = expression;
    ...
    tmp.ident;
}"

is still on <https://dlang.org/spec/statement.html#WithStatement>. Please
compile and run the testcase withstatement2.d. If the assertion were true, the
program would be expected to print 

   before
   after
   before
   after

But it really prints

   before
   after
   before
   before

--


More information about the Digitalmars-d-bugs mailing list