On Thu, Nov 17, 2011 at 1:16 PM, Waldemar Horwat <walde...@google.com>wrote:

> On Thu, Nov 17, 2011 at 3:49 AM, Axel Rauschmayer <a...@rauschma.de>
> wrote:
> >
> > Given that Array already uses `length`, it seems like the obvious choice.
>
> "length" is my choice as well, for the same reason. It's not writable
> in Maps and Sets, so the concerns about the semantics of writing it
> don't apply.
>


Who can resist such a juicy bikeshed...

Just wanted to jump in and say non-writable length is consistent with
String behavior as well, but David makes a good point about length implying
metric topology. David's suggestion of `count` is nice. ISTM what we're
talking about is `cardinality`, but no need to get too silly w/ precision.
Though `size` is just fine with me, and has plenty of prior art.

Whatever name is chosen I'd prefer it be something other than `length`, and
for it to also exist on Array.prototype as a read-only property returning
this.length. This way this new property becomes the new `length` for every
"compound" type, whether it be an object, array, string, map, set, etc. And
`length` would remain for all sequence (numerically-indexed) types.
_______________________________________________
es-discuss mailing list
es-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to