Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!gegeweb.42!gegeweb.eu!nntpfeed.proxad.net!proxad.net!feeder2-2.proxad.net!newsfeed.arcor.de!newsspool3.arcor-online.net!news.arcor.de.POSTED!not-for-mail Content-Type: text/plain; charset="ISO-8859-1" Message-ID: <3387139.pT8TNry37f@PointedEars.de> From: Thomas 'PointedEars' Lahn Reply-To: Thomas 'PointedEars' Lahn Organization: PointedEars Software (PES) Date: Tue, 18 Oct 2011 10:55:18 +0200 User-Agent: KNode/4.4.11 Content-Transfer-Encoding: 7Bit Subject: Re: Objects comparaison ? Newsgroups: comp.lang.javascript References: <1k93ek2.1xghqcy1upjvv5N%unbewusst.sein@fai.invalid> <1783522.fYvYJRLvp5@PointedEars.de> <1411612.7OFYzboFZ6@PointedEars.de> <2326223.jLKWLtnpvF@PointedEars.de> <2065619.34vx2sxqLb@PointedEars.de> <2995463.SPkdTlGXAF@PointedEars.de> <2314707.NYtdq5378b@PointedEars.de> Followup-To: comp.lang.javascript MIME-Version: 1.0 Lines: 32 NNTP-Posting-Date: 18 Oct 2011 10:55:19 CEST NNTP-Posting-Host: 38ef46f1.newsspool1.arcor-online.net X-Trace: DXC=oNUn9BA`BWgUoRk[hk2Walic==]BZ:afn4Fo<]lROoRa<`=YMgDjhgb9oB1OC=45TlDZm8W4\YJNlb@mF9jNikde_dXMBNGELEa4YF1J[l1i=a X-Complaints-To: usenet-abuse@arcor.de Xref: x330-a1.tempe.blueboxinc.net comp.lang.javascript:7526 John G Harris wrote: > Thomas 'PointedEars' Lahn wrote: >> Object.equals = function(obj1, obj2) { >> if (typeof obj1 != "object" || obj1 == null >> || typeof obj2 != "object" || obj2 == null) > > > Attaching a global function (note it has two parameters) to Object is a > very bad idea. Nonsense. You have to differentiate between `Object' and `Object.prototype'. However, this was just a proof-of-concept. Because someone at the ECMA-262 WG could get the idea that an Object.equals() etc. could come in handy at some time, in a real implementation I would use my own namespace, unless the method definition serves as a fallback for a specified method not being implemented (for example, Object.defineProperty()). One of the next JSX revisions will reflect that. > If you want to emulate a namespace you should use a dedicated namespace > object. I am not emulating a namespace here, though. PointedEars -- Danny Goodman's books are out of date and teach practices that are positively harmful for cross-browser scripting. -- Richard Cornford, cljs, (2004)