3 ms·
I wonder if they plan to support nested inline types, such as arrays inside objects, or arrays in arrays. Every time I try to design a layout something like tha
by akkartik 7y ago
I wonder if they plan to support nested inline types, such as arrays inside objects, or arrays in arrays. Every time I try to design a layout something like that I end up having to compute values to initialize various offsets with. Arrays may have a length prefix, or objects may need some metadata in the header. Tagged unions may need to initialize tags.
- cobbzilla 7y agoReading the doc, I believe this is supported with these restrictions: (1) value classes may only contain other value classes, and (2) value classes cannot contain instances of themselves (no circularity).
- efge 7y agoYour first point is incorrect, inline classes can have fields that are regular reference types.
- cobbzilla 7y agoInteresting; I must have “over-read” the restriction. You are correct. Re-reading the doc, the restriction is that all fields of a value type must be final, because value objects do not have identity.