Better handling of noncopyable objects and objects with this(this)
Andrei Alexandrescu via Digitalmars-d
digitalmars-d at puremagic.com
Mon Jun 1 08:45:19 PDT 2015
On 6/1/15 5:50 AM, "Marc =?UTF-8?B?U2Now7x0eiI=?= <schuetzm at gmx.net>" wrote:
> 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?
static = as you read the code
dynamic = as you run the code
> 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.
This has been solved, we have move which obliterates the source with .init.
Andrei
More information about the Digitalmars-d
mailing list