That's called a struct (or class) elsewhere.
That's called a struct (or class) elsewhere.
Elsewhere one would have to define a struct/class and them create an instance.
This becomes immensely helpful for the incredibly lazy with one off object definitions and wrapper types. If you introduce a class definition alongside an instance, you're now forced to manage two peices of code. The class definition and instance definition. In this case they're coupled which aides maintenance in my experience.
What are interesting use cases for more dynamic (i.e. non-fixed set of keys / types)?
I mean, if you need something super-abstract and flexible, you are unlikely to need a built-in convenient syntax to hardcode such values.
For those new to this, good search terms are "row polymorphism", "extensible records", and "polymorphic variants".