Closed gavinking closed 9 years ago
Null[1k]
wasn't that some experimental feature?
Is there anything in ModelUtils
or anywhere else I can use to determine that a tuple is just a fixed-size collection of elements of the same type? I know there's something to get the list of tuple element types, but I haven't used it because that's only useful for encoding in the model, I haven't found if there's already something for decoding...
@chochos I have Unit.isHomogeneousTuple()
and Unit.getHomogeneousTupleLength()
.
Ah, didn't see them. I'll use those instead.
Null[1k]
wasn't that some experimental feature?
Well I can't find it mentioned in the spec. Maybe I'm being blind @gavinking?
§3.2.8
X[1]
means[X]
, for any typeX
, andX[n]
meansTuple<X,X,X[n-1]>
for any typeX
and positive integern
.
Given this code:
I get:
I assume this is because the model serializer tries to walk the whole tuple linked list. That's not necessary for a type like
Null[1k]
which can just be stored as an element type and a length.In general, I think you should look into optimizing how tuple and sequence types are serialized to the model.js.