Object.eq is ready for discussion
brendan at mozilla.com
Tue Sep 7 09:02:32 PDT 2010
On Sep 7, 2010, at 2:39 AM, Maciej Stachowiak wrote:
> On Sep 6, 2010, at 6:01 PM, Brendan Eich wrote:
>> For single-parameter tests, "is" or "has" followed by a NounPhrase is indeed the dominant naming convention. For a dyadic function to pair with Object.hashcode, Object.identical still seems best to me. The only other verb-free thought is to use the language in the ES5 spec (9.12) and call it Object.sameValue.
> You could make it Object.areIdentical(a, b), but I don't think that reads very well.
I know, that was my point!
How about "sameValue"?
I see these suggestions on the thread so far, and in the original proposal:
1 is concise to a fault, and based on LISP precedent. It is also favored by the current proposal's champion.
2 spells it out (I dropped the -s ending, it does not make sense for a function taking two arguments without reordering terms, and avoidable -s endings are usually problematic when programming).
3 is more precise (Breton hoped eq or equals would do some kind of deep compare).
4 adds "is" based on some JS (after Java, after Smalltalk general naming convention) precedent but otherwise is the same as 3.
5 is based on the ES5 spec, but perhaps lacks precision (deep compare? "Value" may connote that).
6 is too close to the cmp or <=> operator of other languages, which results in -1, 0, or 1.
Based on this summary, I favor [3, 1, 5] in that order. I reject [2, 4, 6] for the reasons given. My two cents, hope this helps.
More information about the es-discuss