Hi Vitali,
What you propose looks pretty similar to what I've had in mind for a while for "inline structs".
I might do it more like:
struct Vector3f inlineable {
// `inlineable` keyword generates code that uses dynamic field offsets
// from a table at runtime, thereby enabling inlining with varying layouts.
x @0 :Float32;
y @1 :Float32;
z @2 :Float32;
}
struct MyAwesomeStruct {
foo @[2..4] :Vector3f;
// typical use: layout is like a group, but the type is Vector3f
bar @[0..1,5] :Vector3f;
// split use; useful when the inlined struct adds new fields.
baz @[6] :Vector3f;
// incomplete use; produces compiler warning like:
// Vector3f has been extended with two new fields; to use them you must assign two more numbers.
qux @[7..9] :List(Float32);
// inline list, always has 3 elements.
}
Unfortunately I don't have any timeline for implementing this feature, and I do worry that it will be overcomplicated...
-Kenton