Thread overview | |||||||||
---|---|---|---|---|---|---|---|---|---|
|
September 25, 2020 [Issue 21277] TypeInfo.initializer() is the wrong abstraction, should be TypeInfo.initialize(void*) | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=21277 Andrei Alexandrescu <andrei@erdani.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Hardware|x86_64 |All OS|Linux |All -- |
September 25, 2020 [Issue 21277] TypeInfo.initializer() is the wrong abstraction, should be TypeInfo.initialize(void*) | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=21277 moonlightsentinel@disroot.org changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |moonlightsentinel@disroot.o | |rg --- Comment #1 from moonlightsentinel@disroot.org --- Shouldn't initialize rather accept a void[] instead of void* to detect errors, e.g. invalid size? -- |
September 25, 2020 [Issue 21277] TypeInfo.initializer() is the wrong abstraction, should be TypeInfo.initialize(void*) | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=21277 --- Comment #2 from Andrei Alexandrescu <andrei@erdani.com> --- (In reply to moonlightsentinel from comment #1) > Shouldn't initialize rather accept a void[] instead of void* to detect errors, e.g. invalid size? Even better. Sadly (a) all other primitives use void*; (b) only size mismatches would be detected, not plenty of other errors, so the yield is low. -- |
September 26, 2020 [Issue 21277] TypeInfo.initializer() is the wrong abstraction, should be TypeInfo.initialize(void*) | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=21277 kinke <kinke@gmx.net> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |kinke@gmx.net --- Comment #3 from kinke <kinke@gmx.net> --- 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. -- |
September 26, 2020 [Issue 21277] TypeInfo.initializer() is the wrong abstraction, should be TypeInfo.initialize(void*) | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=21277 --- Comment #4 from Andrei Alexandrescu <andrei@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. -- |
September 26, 2020 [Issue 21277] TypeInfo.initializer() is the wrong abstraction, should be TypeInfo.initialize(void*) | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=21277 --- Comment #5 from kinke <kinke@gmx.net> --- (In reply to Andrei Alexandrescu from comment #4) > This is a low-level primitive not to be used naively, and emplace would use it. User-level code would use emplace. In order to use emplace(), the user needs the type (not its TypeInfo). If all user code knew it, we wouldn't need this thing in TypeInfo at all, and could move all related logic to emplace(). -- |
December 17, 2022 [Issue 21277] TypeInfo.initializer() is the wrong abstraction, should be TypeInfo.initialize(void*) | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=21277 Iain Buclaw <ibuclaw@gdcproject.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Priority|P1 |P4 -- |
Copyright © 1999-2021 by the D Language Foundation