Is `List` really a specification type?
Le 27 nov. 2014 à 16:26, Axel Rauschmayer <axel at rauschma.de> a écrit :
people.mozilla.org/~jorendorff/es6-draft.html#sec-proxy-object-internal-methods-and-internal-slots-ownpropertykeys, people.mozilla.org/~jorendorff/es6-draft.html#sec-proxy-object-internal-methods-and-internal-slots-ownpropertykeys
The method
[[OwnPropertyKeys]] ( )
of proxy objects returns an actualList
to JavaScript code. Does that make sense? I thought it was a specification(-only) type? How an instance is created is vague [1], which is appropriate for a data structure at the specification level, but not for one at the base level.Array
seems like a better choice here. Or an iterator.[1] people.mozilla.org/~jorendorff/es6-draft.html#sec-createlistfromarraylike, people.mozilla.org/~jorendorff/es6-draft.html#sec-createlistfromarraylike
Lists are indeed specification-only types, and the result of the [[OwnPropertyKeys]]
internal method call is never directly observed by the programmer: it is only used as an intermediate result within algorithms. A List is, I presume, a finite ordered sequence of values.
2014-11-27 17:12 GMT+01:00 Claude Pache <claude.pache at gmail.com>:
Lists are indeed specification-only types, and the result of the
[[OwnPropertyKeys]]
internal method call is never directly observed by the programmer: it is only used as an intermediate result within algorithms. A List is, I presume, a finite ordered sequence of values.
Indeed, user-facing functions convert the List to an Array, see e.g. Reflect.ownKeys: people.mozilla.org/~jorendorff/es6-draft.html#sec-reflect.ownkeys
people.mozilla.org/~jorendorff/es6-draft.html#sec-proxy-object-internal-methods-and-internal-slots-ownpropertykeys, people.mozilla.org/~jorendorff/es6-draft.html#sec-proxy-object-internal-methods-and-internal-slots-ownpropertykeys
The method
[[OwnPropertyKeys]] ( )
of proxy objects returns an actualList
to JavaScript code. Does that make sense? I thought it was a specification(-only) type? How an instance is created is vague [1], which is appropriate for a data structure at the specification level, but not for one at the base level.Array
seems like a better choice here. Or an iterator.[1] people.mozilla.org/~jorendorff/es6-draft.html#sec