On 11/23/11 at 10:31, a...@rauschma.de (Axel Rauschmayer) wrote:

Please keep the general js api consistent.

A foolish consistency...

We also use 'hasOwnProperty' and 'forEach' and 'toLocaleString' in JS. Why not 
use those names?
Because it's not the same operation. Neither is it the same thing as .length. An array is a sequential data structure, so it uses .length. A map and a set is not a sequential data structure, so it should not.


I do get the point, though: Whatever is introduced should be supported consistently. But that is already in the works, if arrays will indeed have the same size/cardinality-related property as collections.

The negative example is Java, where you have length, length(), size() and many other things. JavaScript is still fairly uniform, with the DOM being the exception.

<rant>

I did a lot of Java programming 10 to 15 years ago. Most of the pain has subsided into distant memory, but the pain of different method names used to find out how many objects are currently in a collection is still fresh in my memory.

I "duck classify" all objects which store "things" and later give them back without using or modifying them as "collections". Collections include arrays, sets, bags, b-trees, hash tables, etc.

Please give me one way of finding out how many "things" are in a collection so I don't have to remember what "language lawyer" interpretation defined this particular collection's method name.

(I survived the Algol68 report. If you want to have only one precise meaning for a word, don't borrow one from a natural language. Otherwise just accept that in technical usage, a word's meaning(s) may be only loosely connected to its natural language meanings.)

</rant>

Cheers - Bill

-----------------------------------------------------------------------
Bill Frantz        |Security, like correctness, is| Periwinkle
(408)356-8506 |not an add-on feature. - Attr-| 16345 Englewood Ave www.pwpconsult.com |ibuted to Andrew Tannenbaum | Los Gatos, CA 95032

_______________________________________________
es-discuss mailing list
es-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to