This repository has been archived by the owner on Nov 7, 2018. It is now read-only.
Proposal: Remove fixed-length array types and replace with a variant constructor for StructType
#1
Milestone
Currently you can create a fixed-length array type using the
arrayType
method, e.g.,Color.arrayType(1024).arrayType(768)
. However, when extending to value types, this introduces an ambiguity: did you intend to have an array of value types, or a value type that is an array?A possible solution to this dilemna is to instead extend the
StructType
(andValueType
) constructors so that they can take one of two forms:The overload would be based on the type of the second parameter: if it is number, then this is an array-like constructor.
So for example a 2-D array of colors would be created like so:
The idea is that
new StructType(ColorType, 768)
is basically shorthand (very short) for:If we did go down this route, I'd also be inclined to rename
StructType
toObjectType
, so that there are two meta type descriptors:ObjectType
(instances of which are typed objects) andValueType
(instances of which are typed values).The text was updated successfully, but these errors were encountered: