Path: csiph.com!news.swapon.de!eternal-september.org!feeder.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: Ben Bacarisse Newsgroups: comp.lang.javascript Subject: Re: why the ! operator can be used to determine a string is null? Date: Thu, 10 Aug 2017 03:57:09 +0100 Organization: A noiseless patient Spider Lines: 44 Message-ID: <87valwcepm.fsf@bsb.me.uk> References: <87zib8g4eb.fsf@bsb.me.uk> <10915888.O9o76ZdvQC@PointedEars.de> <877eycdzm9.fsf@bsb.me.uk> <2062468.ElGaqSPkdT@PointedEars.de> <871sokduyx.fsf@bsb.me.uk> <1678649.tdWV9SEqCh@PointedEars.de> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Info: mx02.eternal-september.org; posting-host="095bb2b259dd0e10cf340db4dcb09e7e"; logging-data="9270"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+xmhm+xOTE/5ARvwUa1fn0iuLu5YBcu/g=" Cancel-Lock: sha1:E03S7vwW9Y0xzudEuvAybHIa5pE= sha1:pmdjkjjprJzSd95wCormtwGz6xc= X-BSB-Auth: 1.be78c6b2f1bec599b5ea.20170810035709BST.87valwcepm.fsf@bsb.me.uk Xref: csiph.com comp.lang.javascript:33751 Thomas 'PointedEars' Lahn writes: > Ben Bacarisse wrote: > >> Thomas 'PointedEars' Lahn writes: >>> Ben Bacarisse wrote: >>>> Thomas 'PointedEars' Lahn writes: >>>>> Ben Bacarisse wrote: >>>> >>>>>> Further complicated by the fact that there is a character called null >>>>>> (sometimes Null, Nul or NULL) so a string can "be null" in that it >>>>>> contains just that character. >>>>> As we are talking about ECMAScript, it is the Unicode character U+0000 >>>>> NULL (to my surprise, not “NUL” as in US-ASCII) whose standard >>>>> representation is a boxed “NUL” (AFAIK, it is *never* called “null”, >>>>> “Null” or “Nul”): >>>> If you can find an original copy of the standard you'll see a table of >>>> control characters that gives "Abbreviations" (though most are acronyms) >>>> and, as you say, NUL is the abbreviation for the first one. After that >>>> table is an explanation that gives the name as "Null" and the >>>> abbreviation as "Nul" (for some reason not in caps). >>> *I have just cited* “an original copy of the standard”, so please cite >>> evidence supporting your claims. >> >> X3.4-1967 "The American Standard for Information Interchange". > > We are not talking about *that* standard as that has nothing to do with > ECMAScript; we are talking about the *Unicode* character, therefore the > corresponding *Unicode* Standard. I was. The character called NULL in Unicode has a long history. That includes begin called NULL and Null in the X3.4-1963 table, NUL, Nul and Null in the X3.4-1967, NUL, Nul and Null in the first ISO 646 version (essentially X3.4-1967 re-badged), NUL and Null in RFC 20 (1969) and so on and so on. This long history is what causes the confusion which was my only (rather minor) point. And you were (talking about US-ASCII) too. You said it is called NUL in US-ASCII, but that is only the abbreviated name. To see what the character's name really is you must look at some reference document for ASCII. -- Ben.