Second draft: Sum Type by Struct

Richard (Rikki) Andrew Cattermole richard at cattermole.co.nz
Sat Sep 12 21:42:39 UTC 2026


On 13/09/2026 9:35 AM, Per Nordlöw wrote:
> On Saturday, 12 September 2026 at 21:29:50 UTC, Per Nordlöw wrote:
>> On Saturday, 12 September 2026 at 18:36:35 UTC, Richard (Rikki) Andrew 
>> Cattermole wrote:
>>> And quite frankly nobody is implementing this. Its not how struct & 
>>> union field layouting works.
> 
> I say we write in the DIP-spec that the developer must be prepared to in 
> the future handle the case that the discriminator tag is a bitfield with 
> size <= 7, typically <= 3 for GC compliance, rather than a `ubyte`. For 
> the sake of being able to enable that kind of optimization later on.

Okay if we are talking about variants that are bit fields, and turning 
the tag into one, maybe. Maybe that could be a valid optimization in a 
far flung future where we can define a template argument type as a bitfield.

Nobody does something akin to this that I have seen and it is dependent 
upon a different language feature that doesn't exist and probably won't 
exist.

So for now I am going to go: not worth mentioning. All it will do is 
confuse people, especially Walter, he gets side tracked far too easily 
on such proposals.



More information about the dip.development mailing list