Better handling of noncopyable objects and objects with this(this)

via Digitalmars-d digitalmars-d at puremagic.com
Mon Jun 1 05:50:27 PDT 2015


On Monday, 1 June 2015 at 04:43:20 UTC, Andrei Alexandrescu wrote:
> FYI I just created 
> https://issues.dlang.org/show_bug.cgi?id=14638 as one of 
> possibly several language enhancements to improve usability of 
> noncopyable types (most allocators are not copyable) and to 
> enhance performance of objects that define this(this). -- Andrei

What do "static use" and "dynamic use" mean here?

Also, object with destructors need to have more restrictions:

     S {
         ~this();
     }

     void foo() {
         S s;
         if(condition)
             bar(s);
         // <- should we run the destructor here?
     }

This can either be solved by making such cases non-eligible, or 
by "remembering" whether an object was moved using a hidden 
boolean variable. AFAIK the latter is incidentally the solution 
Rust chose.


More information about the Digitalmars-d mailing list