proposal-record-tuple
proposal-record-tuple copied to clipboard
Avoid looking up @@isConcatSpreadable for tuples.
Right now the spec will check @@isConcatSpreadable on Tuple.prototype when passed a tuple, before defaulting to returning true for tuples:
1. If Type(O) is not Object or Tuple, return false.
2. Let spreadable be ? GetV(O, @@isConcatSpreadable).
3. If spreadable is not undefined, return ! ToBoolean(spreadable).
4. If ! IsTuple(O), return true.
5. Return ? IsArray(O).
This means that if someone creates Tuple.prototype[Symbol.isConcatSpreadable] and returns false, it would change how Tuples behave in concat. It might make sense to do an early return for IsTuple and always return true - keeping the behavior 'static'.
cc: @michaelficarra
It would be confusing if someone did that, and Tuple concat still spreaded tuples but Array concat didnt. If both are hardcoding it, then it would still be confusing that primitive Tuple spread but boxed tuples dont.
I think they should just be looked up via the symbol.