Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.javascript > #33440
| Path | csiph.com!eternal-september.org!feeder.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail |
|---|---|
| From | Ben Bacarisse <ben.usenet@bsb.me.uk> |
| Newsgroups | comp.lang.javascript |
| Subject | Re: x === x |
| Date | Tue, 30 May 2017 14:34:29 +0100 |
| Organization | A noiseless patient Spider |
| Lines | 34 |
| Message-ID | <874lw231ui.fsf@bsb.me.uk> (permalink) |
| References | <JavaScript-20170530123255@ram.dialup.fu-berlin.de> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=iso-8859-1 |
| Content-Transfer-Encoding | 8bit |
| Injection-Info | mx02.eternal-september.org; posting-host="100ceef5a96f3ad6ffee895ab2330e2d"; logging-data="16000"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX193p73CGcL4OkH/NC4uQHp5lLcX+/qlE9c=" |
| Cancel-Lock | sha1:fH7+cLoq0JO/YB3mrMm2pJ5y75A= sha1:/xLUGS+jqvBPWZyD+fVT2HNhcII= |
| X-BSB-Auth | 1.b138b0f3c0df95d82c3e.20170530143429BST.874lw231ui.fsf@bsb.me.uk |
| Xref | csiph.com comp.lang.javascript:33440 |
Show key headers only | View raw
ram@zedat.fu-berlin.de (Stefan Ram) writes:
> In mathematics, usually, when »...« is a certain term, we have
>
> ... === ...
>
> for the same term left and right.
>
> In JavaScript, this does not always hold for expressions, albeit
> possibly sometimes for different reasons:
>
> Math.random() === Math.random()
> NaN === NaN
> [] === []
> ( {} === {} )
> ( ()=>0 )===( ()=>0 )
>
> In the first case, we cannot be sure that it will evaluate to
> »false«, but this is is possibly.
>
> The last three cases are similar, but it is also remarkable
> how one needs to add parentheses: no parens required for the
> array, outer parens for the objects,
What's wrong with {} === {}?
> and two pairs of parens for the functions.
This one makes sense. You are much more likely to want === in the body
of the arrow function so you want the grammar to cause (x) => x ===
... to mean (x) => (x === ...) rather than ((x) => x) === ...
--
Ben.
Back to comp.lang.javascript | Previous | Next — Next in thread | Find similar | Unroll thread
Re: x === x Ben Bacarisse <ben.usenet@bsb.me.uk> - 2017-05-30 14:34 +0100
Re: x === x Ben Bacarisse <ben.usenet@bsb.me.uk> - 2017-05-30 15:02 +0100
Re: x === x Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2017-05-30 16:22 +0200
Re: x === x Ben Bacarisse <ben.usenet@bsb.me.uk> - 2017-05-31 01:02 +0100
Re: x === x Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2017-05-31 12:39 +0200
Re: x === x Ben Bacarisse <ben.usenet@bsb.me.uk> - 2017-05-31 21:52 +0100
Re: x === x Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2017-05-31 23:39 +0200
Re: x === x Ben Bacarisse <ben.usenet@bsb.me.uk> - 2017-06-01 01:46 +0100
Re: x === x Julio Di Egidio <julio@diegidio.name> - 2017-06-01 00:14 -0700
Re: x === x John G Harris <niam@jghnorth.org.uk.invalid> - 2017-06-01 10:39 +0100
Re: x === x Julio Di Egidio <julio@diegidio.name> - 2017-06-01 03:37 -0700
Re: x === x John G Harris <niam@jghnorth.org.uk.invalid> - 2017-06-01 18:54 +0100
Re: x === x Ben Bacarisse <ben.usenet@bsb.me.uk> - 2017-06-01 21:54 +0100
Re: x === x John G Harris <niam@jghnorth.org.uk.invalid> - 2017-06-02 11:06 +0100
Re: x === x John G Harris <niam@jghnorth.org.uk.invalid> - 2017-06-02 11:08 +0100
Re: x === x John G Harris <niam@jghnorth.org.uk.invalid> - 2017-06-02 10:56 +0100
Re: x === x Ben Bacarisse <ben.usenet@bsb.me.uk> - 2017-06-04 12:50 +0100
Re: x === x John G Harris <niam@jghnorth.org.uk.invalid> - 2017-06-04 14:30 +0100
Re: x === x Dr J R Stockton <J.R.Stockton@physics.org> - 2017-06-04 09:03 -0700
Re: x === x Ben Bacarisse <ben.usenet@bsb.me.uk> - 2017-06-01 14:45 +0100
Re: x === x Julio Di Egidio <julio@diegidio.name> - 2017-06-01 07:00 -0700
Re: x === x Julio Di Egidio <julio@diegidio.name> - 2017-06-01 00:00 -0700
csiph-web