Help in reviewing druntime PR

kinke noone at nowhere.com
Thu Dec 9 21:02:23 UTC 2021


On Thursday, 9 December 2021 at 15:52:46 UTC, Stanislav Blinov 
wrote:
> This shan't be in Phobos, it needs to be in druntime. At the 
> moment we have the whole gang of emplace, move, etc. duplicated 
> between the two :\ These things need to reside in 
> `core.lifetime` and threabout, usable without Phobos. Phobos 
> could public alias if need be, but certainly not the other way 
> around :)

They've been moved from Phobos to druntime - but not 1:1, that's 
why the Phobos versions still exist. IIRC, the only reason is 
that the Phobos version additionally checks for self-references, 
which brings in an awful lot of code: 
https://github.com/dlang/druntime/pull/2442#issuecomment-452136871

I'd argue that self-references are invalid anyway (but not 
detected by the compiler) and problematic for implicit moves by 
the compiler - at least as long we don't have move ctors to fix 
up such self references. From https://dlang.org/spec/struct.html:

> A struct is defined to not have an identity; that is, the 
> implementation is free to make bit copies of the struct as 
> convenient.

Wrt. the review, please bear with me, I'm pretty busy at the 
moment.


More information about the Digitalmars-d mailing list