proposal-record-tuple
proposal-record-tuple copied to clipboard
Review feedback
Main points:
-
I was quite confused by the
ToStringtable until I saw #319; if we keep this behavior, we should add a note explaining it. -
Shouldn't
SameValueNonGenericbe calledSameValueGeneric? Seems like a typo. -
Tuple
[[GetOwnProperty]]and[[Get]]are attempting to directly access[[Sequence]]on a Tuple exotic object instead of going through[[TupleData]]. -
Is it intentional that
Record.fromEntriespasses theadderAbstract Closure directly toAddEntriesFromIterablewhileTuple.fromdoesCreateBuiltinFunctionfirst?
Nitpicky editorial stuff:
-
RecordPropertyDefinitionEvaluationcould use a ? instead of an explicit ReturnIfAbrupt forPropertyName : AssignmentExpression. -
In
TupleSequenceAccumulation, the use ofSpreadElementseems to align with Array, but there would be less redundancy if we align with Record and useTupleElement : AssignmentExpression | ... AssignmentExpressioninstead. -
Kind of annoying that Tuple's
Evaluationcomes afterTupleSequenceAccumulatorinstead of before it, though I see that this too is in alignment with Array instead of Record.
Thanks @rkirsling this is great. We'll work through these items.
- I was quite confused by the ToString table until I saw https://github.com/tc39/proposal-record-tuple/pull/319; if we keep this behavior, we should add a note explaining it.
Good idea!
- Shouldn't SameValueNonGeneric be called SameValueGeneric? Seems like a typo.
This AO is a rename of SamevalueNonNumeric. It was previously nonNumeric because the input is not allowed to be a Number or a BigInt. It is now nonGeneric because the input is even less generic because the parameters can now also not be records or tuples.
- Tuple [[GetOwnProperty]] and [[Get]] are attempting to directly access [[Sequence]] on a Tuple exotic object instead of going through [[TupleData]].
Great spot!
- Is it intentional that Record.fromEntries passes the adder Abstract Closure directly to AddEntriesFromIterable while Tuple.from does CreateBuiltinFunction first?
I don't think so, this looks like a spec bug. Thanks!
I haven't complained about "NonGeneric" yet because I don't have a better suggestion, but my review will hopefully include some :-)
This AO is a rename of SamevalueNonNumeric. It was previously nonNumeric because the input is not allowed to be a Number or a BigInt. It is now nonGeneric because the input is even less generic because the parameters can now also not be records or tuples.
Yeah, that's why I was viewing it as a typo. The generic (i.e. default) path used to be describable as "non-numeric" because the non-generic (i.e. special) paths were specifically numeric, but with R&T we now need to be more abstract than that.
I think I understand the different perspectives now. I am seeing the word generic as "not specific - can handle any input type". So "nonGeneric" seems correct because the AO is specific, it only handles a subset of types. I can also see "Generic" as being interpreted as "handles a related a class of things" similar to WeakSet<T extends object>, where now the AO is 'generic' with a specifier on the group it is generic on.
What do we think a better name could be? Maybe SameValueBase or SameValueCore because it doesn't call out to any other AOs? Or SameValueNonNumericandNonComposite or SVNNNC for short.
I would say SameValueDefault or SameValueInner, since it's exclusively used after ruling out all the more specific options.
( Base or Core would certainly be in that direction too; I can't seem to find a precedent in scanning through AOs...)
I think the difficulty lies in trying to name it as if it were an operation with a self-standing reason to exist; from that vantage point, I think the best you could say is SameValueTriviallyComparable.