draft proposal for Sum Types for D
Basile.B
b2.temp at gmx.com
Wed Nov 30 19:45:51 UTC 2022
On Tuesday, 29 November 2022 at 20:50:15 UTC, H. S. Teoh wrote:
> On Tue, Nov 29, 2022 at 08:37:57PM +0000, Jacob Carlborg via
> Digitalmars-d wrote: [...]
>> ### ABI
>>
>> I think a section on ABI is missing. It should specify the
>> memory layout of sumtypes, just as for existing language
>> constructs [1].
>
> Agreed.
>
>
>> What's even more important than the memory layout is the value
>> of the tag. Something needs to be specified in regards to the
>> value of the tag. One needs to be able to draw some
>> conclusions about what happens with the value if members are
>> added, removed or reordered. Ideally the tag value of existing
>> members should not change. These are important things when
>> using sumtypes at ABI boundaries.
>
> You can't dynamically change a sumtype (add/remove/reorder its
> constituents) after the fact, because that may change their
> size, which implies an ABI change.
You can add members, Crystal does that all the time.
More information about the Digitalmars-d
mailing list