On Apr 2, 2011, at 11:44 AM, David Bruant wrote: > Hi, > > This proposal is another attempt to address the DOM Element+EventTarget > multiple inheritance issue in ECMAScript.
That issue was resolved by putting EventTarget on the inheritance chain. See http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#node and http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html 9.2 DOM Core "Node now inherits from EventTarget." In general, WebIDL is not spec'ing multiple "instanceof" inheritance any longer. It is explicitly linearizing to work best with JS. > The idea is to turn the == operator into an equivalence relation > operator. The careful reader will instantly notice that actually, it > already is (even if not explicitly stated in the spec). No, == is not an e.r. You must mean only in the cases where typeof a == typeof b, then a == b <=> a === b, and === is an e.r. But that does not mean == is an e.r. For mismatching types, == is not transitive, so not an e.r. Also, for NaNs it is not reflexive (neither is ===). > // Assuming o is an object already in the environment > var o2 = Object.create(null, {}, o); // third argument is an object > // The newly created object and o will be in the same equivalence class > // If the third argument is omitted, the new object belongs to a new > equivalence class. > --- > We have: > - o2 == o > - o2 !== o > - For all object a: o2 == a iff o == a (by transitivity by is in the > definition of an equivalence class) What developers want, IMHO, is not Object.create and a specific object o to pass as a member of an existing e.c., in which to create a new object. That is tedious and painful, it requires _a priori_ arrangements. Rather, many developers wish == would work at least like so (same for <): [1, 2] == [1, 2]. Hence the tuples and records ideas in http://brendaneich.com/2011/01/harmony-of-my-dreams/ whereby #[1, 2] == #[1, 2] and #[1, 2] < #[1, 3]. More could be done, for sure. If Array users, say on a module by module basis, could "opt in" to better == and < semantics, that might be worth the trouble of adding such opt-in new operators. But not just via Object.create. And instanceof EventTarget is now a non-issue. /be
_______________________________________________ es-discuss mailing list es-discuss@mozilla.org https://mail.mozilla.org/listinfo/es-discuss