Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!news.solani.org!.POSTED!not-for-mail From: Thomas 'PointedEars' Lahn Newsgroups: comp.lang.javascript Subject: Re: null and NaN Date: Sat, 06 Jun 2015 08:39:11 +0200 Organization: PointedEars Software (PES) Lines: 104 Message-ID: <1887823.QYRqh1XSJF@PointedEars.de> References: Reply-To: Thomas 'PointedEars' Lahn Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8Bit X-Trace: solani.org 1433572916 30043 eJwFwYERgDAIA8CVIJVYx4Ec2X8E/+swqfdh8SmX17nTxpe1jeF16LYWKEUDBx0zsQqB3vwBOQ8R9g== (6 Jun 2015 06:41:56 GMT) X-Complaints-To: abuse@news.solani.org NNTP-Posting-Date: Sat, 6 Jun 2015 06:41:56 +0000 (UTC) User-Agent: KNode/4.14.2 X-User-ID: eJwNy0kBwDAIBEBLEK6NHCDgX0I7/zFx9g51c7W1RVWN5gxb7w4kt4pYJHnmhl0niUWvGwH/zFsBnNAjrx99gsoWBA== Cancel-Lock: sha1:9zEaAdFtdOMBuFwzbPppcLPHb3w= X-NNTP-Posting-Host: eJwFwQERADEIAzBLQClscvge8y/hE6K81Fms5OODhw6MuJS1XafBDltD+r5Zbn/hhVCuND/zLhBd Xref: csiph.com comp.lang.javascript:28000 Joao Rodrigues wrote: > On 02/06/2015 14:28, Stefan Ram wrote: >> Sometimes, it has been questioned whether it was wise to >> implement >> >> typeof null >> "object" > > It happens due to a bug in the first version of JS [1]. > > [1] Again, your research is flawed. You are still lacking the healthy scepticism that is the mark of a good scientist. What you are citing is *unsubstantiated*, *non-authoritative* *speculation*; likely a historian’s fallacy. [1] It could be a bug, but it could also have been *intentional*. Only Brendan Eich, sole author of the first JavaScript version [2], can say for sure. However, that the ECMAScript Language Specification [3], the standard which is originally based on JavaScript 1.1 and JScript 1.0 (ibid.), says: ,-[1st edition] | | 4.3.11 Null | | Null is a primitive value that represents the null, empty, or nonexistent | reference ^^^^^^^^^ ,-[2nd Edition] | | 4.3.11 Null value | | The null value is a primitive value that represents the null, empty, or | non-existent reference. ^^^^^^^^^ ,-[Edition 3] | | 4.3.11 Null Value | | The null value is a primitive value that represents the null, empty, or | non-existent reference. ^^^^^^^^^ ,-[5th Edition] | | 4.3.11 | | null value | primitive value that represents the intentional absence of any | object value. ^^^^^^ ,-[5.1 Edition] | | 4.3.11 null value | | primitive value that represents the intentional absence ^^^^^^^^^^^^^^^^^^^ | of any object value ^^^^^ ,-[6th Edition Final draft [4]] | | 4.3.12 | | null value | primitive value that represents the intentional absence of any | object value ^^^^^^ indicates that it is _not_ a bug. “null” *has* something to do with objects that other primitive values have not. Whether it was a good idea to design the “typeof” operator that way, and make it hard to tell “null” from a valid object reference is a *separate* issue. As Brendan Eich freely admits in hindsight, he made several *design* errors in the creation of JavaScript, not least because the new language had to be available soon. The JavaScript type system was one of them. [5] (Employers, take this as a lesson: Rushing software developers for quick profit, not allowing to let them think things through and to discuss them with their peers, almost invariably leads to bad design decisions that bite you even decades later. BTST.) ____________ [1] [2] Krill, Paul (2008). “JavaScript creator ponders past, future”. In: “InfoWorld. Developer World.” [3] p. [4] [5] -- PointedEars FAQ: | SVN: Twitter: @PointedEars2 | ES Matrix: Please do not cc me. / Bitte keine Kopien per E-Mail.