Help in reviewing druntime PR

Stanislav Blinov stanislav.blinov at
Thu Dec 9 15:52:46 UTC 2021

On Thursday, 9 December 2021 at 15:06:24 UTC, Paul Backus wrote:
> On Thursday, 9 December 2021 at 09:47:10 UTC, Stanislav Blinov 
> wrote:
>> ...I mean, it looks like this would have to be ported into 
>> Phobos as well, seeing as there's still this weird code 
>> duplication for those symbols going on. Though I would rather 
>> see those things removed from Phobos and aliased into core, 
>> deprecated, then deleted for good.
>> But I could add the Phobos change too if there's more eyes 
>> there.
> Something like this is already in Phobos, under the name 
> [`std.traits.hasNested`][1].
> However, the behavior is not exactly the same. The Phobos 
> version recurses into classes, even though they are reference 
> types, leading to results like the following:
> ```d
> void example()
> {
>     import std.traits;
>     class Nested {}
>     static struct NotNested
>     {
>         Nested nested;
>     }
>     pragma(msg, hasNested!NotNested); // true
> }
> ```
> I'm not really sure what we should do about this. The Phobos 
> behavior seems obviously incorrect to me, but "fixing" it is a 
> potentially-breaking change. Maybe the right thing to do is to 
> add the fixed version to Phobos as 
> `std.traits.hasContextPointers` and mark `hasNested` as 
> outdated/unrecommended in the documentation. Thoughts?
> [1]:

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 :)

More information about the Digitalmars-d mailing list