DIP 1005 - Preliminary Review Round 1
Andrej Mitrovic via Digitalmars-d
digitalmars-d at puremagic.com
Sat Apr 22 10:06:50 PDT 2017
On Saturday, 22 April 2017 at 16:14:29 UTC, Timon Gehr wrote:
> Please reconsider. This is new syntax. It looks like old syntax
> but behaves differently.
I suppose the biggest issue is:
-----
module mod;
import std.stdio;
struct A
{
~this ( ) { writeln("dtor"); }
}
-----
-----
module test;
class C
{
with (import mod) A a; // declaration, lives as long as C
lives
void test ( )
{
with (import mod) // statement
{
A a; // destroyed on exit of scope
}
// a was destroyed, and is not even visible here
}
}
-----
I can see how this can be a pain point. If it's a big worry then
I'd be ok with using one of the syntactic alternatives, like
'import (std.stdio);'.
More information about the Digitalmars-d
mailing list