[Issue 21277] TypeInfo.initializer() is the wrong abstraction, should be TypeInfo.initialize(void*)

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sat Sep 26 12:52:19 UTC 2020


https://issues.dlang.org/show_bug.cgi?id=21277

--- Comment #4 from Andrei Alexandrescu <andrei at erdani.com> ---
(In reply to kinke from comment #3)
> IMO, a general problem of this method is the ambiguity for class types -
> initializer for a class *ref* or a class *instance*? [It's the latter.]
> 
> There's also a tight interconnection with the core.lifetime.emplace()
> template, which uses it for classes and non-zero-init structs. emplace()
> takes a pointer to a class ref to initialize the ref with null, and a void[]
> to emplace a class instance.

Good point. This is a low-level primitive not to be used naively, and emplace
would use it. User-level code would use emplace.

Point is, we don't have information about void fields. The proposed signature
of initialize() would at least acknowledge their existence.

--


More information about the Digitalmars-d-bugs mailing list