The following syntax is the only way to instantiate a message with a named type. For instance,
This is done via type rectification.
It is worth noting that these arrays are statically typed, and the elements within must have a compatible type under "type rectification". An interesting example for the need of type rectification is the following snippet.
Here, the elements in the array have the same type, and the above is equal to:
When you have an array like:
The primary way of getting access to a particular element is via the index lookup operator (). The result of the index operator has a particular twist on the result type. For instance, the following code:
The result type is maybe of whatever the element type is, and this both forces the checking of range and contends with invalid ranges. The only way to really know the second type is via an if statement like so:
While the above sample is trivial, this construct enforces the appropriate type and range to disallow bad things to go bump in the night and force an error when things are incorrect.
Type rectification is the process of taking two values of two types, then finding (or creating) a type which allows both of them of them to fit together. For instance, the rectified type of int and double is double because double can hold both values.
- write about type rectification more
- outline the rules for how messages are joined under an array
- detail why this is important
- detail how this helps things become better