See: nested records (Dr Okie's notes)
- a record (`Point`),
- a record-of-records (`Line`), and
Code from class: employees_v1.adb
- an array-of-record-of-records (`LineList`)
ibarland's particular reminders re presentation:
record Point (and initializer, by posn and by name)
make diagram closer to the raw row-of-mem-locs;
use dotted-line between fields, and on right use `}`
reminder: access fields via `.`
record Line (initialize using 2 vars, and initialize using literals)
make diagram closer to the raw row-of-mem-locs;
use squiggle-line between its two fields, and on right use nested `}`
draw a mem-diagram of array-of-Line (as one big mem chunk)
THEN ask: how do we refer to [this cell here]; answer: lines(2).start.y
The mostly-analagous Java:
see NestedRecords.java
What if we make an array of 10 Employees, and read in/fill only 3 of them?
We can do this, but we need to track how many of the array-locations represent "real" data.
(This is how ArrayList works -- an array which is only partially full.
Though it has two additional aspects: re-sizing on inserts,
and it's fully encapsulated as an Abstract Data Type `List`.
We say that internally ArrayList uses a "backing array".)
See:
employees_v2.adb (the backing array, and separately track the count)
and then
employees_v3.adb (combine these two related pieces into one record/object/struct)