News for hackers. Stuff that matters.
Re:The Road to Valhalla by akkartik on Friday December 06, 2019 @09:01PM (#21727947)
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.
Re:The Road to Valhalla by cobbzilla on Friday December 06, 2019 @09:21PM (#21728030)
Reading 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).
Re:The Road to Valhalla by efge on Friday December 06, 2019 @09:27PM (#21728052)
Your first point is incorrect, inline classes can have fields that are regular reference types.
Re:The Road to Valhalla by cobbzilla on Friday December 06, 2019 @10:06PM (#21728203)
Interesting; 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.