Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.javascript > #28000

Re: null and NaN

From Thomas 'PointedEars' Lahn <PointedEars@web.de>
Newsgroups comp.lang.javascript
Subject Re: null and NaN
Date 2015-06-06 08:39 +0200
Organization PointedEars Software (PES)
Message-ID <1887823.QYRqh1XSJF@PointedEars.de> (permalink)
References <null-20150602191404@ram.dialup.fu-berlin.de> <mkr6jk$sfb$1@speranza.aioe.org>

Show all headers | View raw


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] <http://www.2ality.com/2013/10/typeof-null.html>

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] <http://en.wikipedia.org/wiki/Historian%27s_fallacy>
[2] Krill, Paul (2008). “JavaScript creator ponders past, future”.
    In: “InfoWorld. Developer World.”
    <http://www.infoworld.com/d/developer-world/javascript-creator-ponders-past-future-704>
[3] <http://www.ecma-international.org/publications/standards/Ecma-262.htm> 
    p.
[4] 
<http://wiki.ecmascript.org/lib/exe/fetch.php?id=harmony%3Aspecification_drafts&cache=cache&media=harmony:ecma-262_6th_edition_final_draft_-04-14-15.pdf>
[5] <https://brendaneich.com/2005/11/js2-design-notes/>

-- 
PointedEars
FAQ: <http://PointedEars.de/faq> | SVN: <http://PointedEars.de/wsvn/>
Twitter: @PointedEars2 | ES Matrix: <http://PointedEars.de/es-matrix>
Please do not cc me. / Bitte keine Kopien per E-Mail.

Back to comp.lang.javascript | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Re: null and NaN Joao Rodrigues <groups_jr-1@yahoo.com.br> - 2015-06-05 00:55 -0300
  Re: null and NaN Robert Heller <heller@deepsoft.com> - 2015-06-05 06:57 -0500
    Re: null and NaN Steven D'Aprano <steve@pearwood.info> - 2015-06-07 18:47 +1000
  Re: null and NaN Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2015-06-06 08:39 +0200
    Re: null and NaN Joao Rodrigues <groups_jr-1@yahoo.com.br> - 2015-06-06 23:15 -0300
      Re: null and NaN Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2015-06-07 09:59 +0200
        Re: null and NaN Joao Rodrigues <groups_jr-1@yahoo.com.br> - 2015-06-07 22:30 -0300
          Re: null and NaN Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2015-06-10 20:48 +0200
            Re: null and NaN Joao Rodrigues <groups_jr-1@yahoo.com.br> - 2015-06-11 10:01 -0300
              Re: null and NaN "Christoph M. Becker" <cmbecker69@arcor.de> - 2015-06-11 15:28 +0200
                Re: null and NaN Joao Rodrigues <groups_jr-1@yahoo.com.br> - 2015-06-11 11:34 -0300
                Re: null and NaN "Christoph M. Becker" <cmbecker69@arcor.de> - 2015-06-11 21:07 +0200
                Re: null and NaN Joao Rodrigues <groups_jr-1@yahoo.com.br> - 2015-06-11 17:29 -0300
                Re: null and NaN "Christoph M. Becker" <cmbecker69@arcor.de> - 2015-06-11 23:15 +0200

csiph-web