Path: csiph.com!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: Wed, 09 Aug 2017 21:04:09 +0100 Organization: A noiseless patient Spider Lines: 41 Message-ID: <87bmnofqyu.fsf@bsb.me.uk> References: <87zib8g4eb.fsf@bsb.me.uk> <873e9645-1173-403d-bf7f-08ddcb17c057@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: mx02.eternal-september.org; posting-host="6b106f5f939d4678e293715be9be63dc"; logging-data="5446"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18l9VKK5E/I5uttVstCiVgbiESDkGWmapg=" Cancel-Lock: sha1:Ee/Q6QbovEwVIro1FlNJD/+Sb7E= sha1:yFUURNLL6jd74PxCxnLV/szRgX8= X-BSB-Auth: 1.35b64f4d4fe4d5c1cfce.20170809210409BST.87bmnofqyu.fsf@bsb.me.uk Xref: csiph.com comp.lang.javascript:33738 Julio Di Egidio writes: > On Wednesday, August 9, 2017 at 5:14:14 PM UTC+2, Ben Bacarisse wrote: >> "Evertjan." writes: >> > Jon Ribbens wrote on 09 Aug 2017 in >> > comp.lang.javascript: >> > >> >> Unfortunately people tend to be very imprecise as to the meaning of >> >> the phrase "null string", and may variously mean either the actual >> >> null value or an empty string. >> > >> > Indeed, >> > a string is NEVER null, >> > because then it is NOT a string. >> >> 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. > > Nope, no programmer would call that a null string: that would be *empty* > in languages where the NUL character is a terminator, not in JS anyway: > > I'm not sure what the purpose of the link is other than to delay by one post your insulting and then pretending to plonk me. Obviously it's not a null string but it is a string with just a null. In a language with no character type (like ECMAScript), strings of length one are often used for the same sort of purpose so what we both note is an incorrect use of the term is not unlikely to occur. >> It's not a clear way to speak about such >> things but we're all guilty of using short-hands now and again. > > Speak for yourself, and RTFM. He says, using a shorthand! :-) -- Ben.