On Tue, Feb 14, 2012 at 4:20 PM, Tab Atkins Jr. <[email protected]>wrote:
> On Tue, Feb 14, 2012 at 1:10 PM, Dean Landolt <[email protected]> > wrote: > > On Tue, Feb 14, 2012 at 3:54 PM, Tab Atkins Jr. <[email protected]> > > wrote: > >> On Sun, Feb 12, 2012 at 7:08 PM, Brendan Eich <[email protected]> > wrote: > >> > See the thread containing Dean Landolt's dissent on 'length' being the > >> > best > >> > name: > >> > > >> > > https://mail.mozilla.org/pipermail/es-discuss/2011-November/018571.html > >> > > >> > The January 19 2012 meeting notes recorded here: > >> > > >> > > https://mail.mozilla.org/pipermail/es-discuss/2012-January/019784.html > >> > > >> > include "At next meeting MarkM will present a tiny API proposal for > maps > >> > and > >> > sets." > >> > >> In today's practice, iterables are ducktyped by the presence of a > >> "length" property. > > > > > > IME they're ducktyped by the presence of forEach (this is far from > perfect). > > Length has nothing to do with iterability. What about generators? > > I don't want to go looking anything up right now, but I have lots of > memories of things looking for the presence of "length" to denote an > array-like. > > > >> I don't think an "[implication of] metric > >> topology" matters to basically anyone who's not a huge language-design > >> nerd. ^_^ > > > > I'm pretty sure math geeks would disagree. > > We math geeks are also thin on the ground, so the point of my > assertion (that the number of people who care is vanishingly small) > still holds. > No doubt. The long tail of geekery is long :) > >> Additionally, having multiple names for the "size of" property makes > >> it more difficult to learn, and more difficult to create generic code. > > > > That's a bold assertion. I'd argue that having two different names for > two > > things that are fundamentally different is quite practical. It's > especially > > useful for writing generic code ;) > > They're not fundamentally different unless you go to some lengths (pun > not intended) to make them so. "length" is the size of a collection; > it doesn't immediately denote anything about the indexability of said > collection. > What about sparse arrays? What's the difference between the count of items and the last index? These are two concepts, right? And as far as es is concerned `length` already denotes the last numerical index. > > But more practically we need different names -- setting length has > certain > > expectations that wouldn't hold across all collections. Violating these > > expectations would make things ever more difficult to learn...and generic > > code even harder to write. > > This sounds pretty reasonable. The fact that 'length' is settable on > Array is pretty weird in the first place imo, and as you say, it's > nonsensical for Set/Map. Okay, I'm more in favor of 'count' or > something being a readonly on all the collections then, as you > suggested in the thread Brendan linked, so that it can become the "new > length". > Great. The more I look around the more appropriate `count` seems.
_______________________________________________ es-discuss mailing list [email protected] https://mail.mozilla.org/listinfo/es-discuss

