Enumerated Unions (sum types)

Dukc ajieskola at gmail.com
Thu Sep 12 11:19:07 UTC 2024


On Thursday, 12 September 2024 at 10:33:35 UTC, Paul Backus wrote:
> On Thursday, 12 September 2024 at 10:24:01 UTC, Dukc wrote:
>> Yes, if the foreign language will only handle it via a 
>> pointer. But if the ABI is nailed down, the foreign language 
>> can have the sum type on an array or at the stack, and pass 
>> them to D functions by value.
>
> Even for that, all the foreign language has to know is the size 
> and the alignment. It doesn't have to know how the data is 
> arranged internally.

But to know the size of the sum type, the existence, size and 
alignment of the tag field has to be known. That's why I'd prefer 
it to be specified.


More information about the dip.ideas mailing list