Many programming languages offer a simple construct to address a single attribute within a data structure (record) e.g.:
customer.name.
Does Snap! support something similarly efficient, easy-to-use, maintainable and self-documenting?
Some non-ideal candidate solutions I considered are:
ITEM (name) OF (customer), “name” being a previously initialized constant number;
ITEM (name()) OF (customer), “name()” being a function reporting a constant number;
ITEM (attribute (person)(name)) OF (customer), “attribute” being a (dual argument) function reporting the order of a specified attribute within a specified data structure)
CALL (customer ( )) W/INPUT (name), “customer” being a variable containing a previously initialized (OOP) function.
Actually sometime after I had posted my question, but shortly before I read your reply (@jens: thx!) it dawned to me this feature was recently introduced. I agree it resembles other languages’ dot notation.
Thinking aloud a little further: how about data structures with multiple levels? Like:
customer
name
1.a. first name
1.b. family name
address ...
Using the same mechanism, e.g. a customer's family name can be addressed as: ITEM (family name) OF (ITEM (name) OF (customer)).
A downside of this mechanism: it only works if field names are included in each of the records, which may involve a lot of redundant memory usage. This, I assume, is due to the fact that Snap! does not explicitly support user-defined data types.