Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.javascript > #31858
| From | John Harris <niam@jghnorth.org.uk.invalid> |
|---|---|
| Newsgroups | comp.lang.javascript |
| Subject | Re: Trying to understand OOP (newbie to OOP) |
| Date | 2016-12-14 16:42 +0000 |
| Organization | A noiseless patient Spider |
| Message-ID | <5ft25c55r32vip25tukphfp7qe5hp89f14@4ax.com> (permalink) |
| References | (2 earlier) <5769635.4vTCxPXJkl@PointedEars.de> <152u4c5l9g1c3og69evu3nre4ov14c3is6@4ax.com> <11687593.uLZWGnKmhe@PointedEars.de> <31305chjkk5nk6utdqkqt6hu4g0b7h9fke@4ax.com> <3306468.kQq0lBPeGt@PointedEars.de> |
On Tue, 13 Dec 2016 20:23:35 +0100, Thomas 'PointedEars' Lahn
<PointedEars@web.de> wrote:
>John Harris wrote:
>
>> On Tue, 13 Dec 2016 13:51:28 +0100, Thomas 'PointedEars' Lahn
>> <PointedEars@web.de> wrote:
<snip>
>>> var e = {};
>>> var f = e;
>>> var g = e;
>>>
>>> /* true true true */
>>> console.log(e == f, f == g, e == g);
<snip>
>There is only *one* object here, conceptually and its data stored in heap
>memory. “e”, “f”, and “g” are merely identifiers of variables, each of
>which *currently* holds as value a reference to *one and the same object*:
<snip>
Why does the term e == f evaluate to true here? Let us see what the
relevant bits of the current ECMAScript Standard (6th ed) say.
Sec 12.10.3 :
EqualityExpression : EqualityExpression == RelationalExpression
1. Let lref be the result of evaluating EqualityExpression.
2. Let lval be GetValue(lref).
...
4. Let rref be the result of evaluating RelationalExpression.
5. Let rval be GetValue(rref).
...
7. Return the result of performing
Abstract Equality Comparison rval == lval.
Sec 7.2.12 Abstract Equality Comparison
The comparison x == y, where x and y are values, produces true or
false. Such a comparison is performed as follows:
...
3. If Type(x) is the same as Type(y), then
a. Return the result of performing
Strict Equality Comparison x === y.
...
Sec 7.2.13 Strict Equality Comparison
The comparison x === y, where x and y are values, produces true or
false. Such a comparison is performed as follows:
...
8. If x and y are the same Object value, return true.
9. Return false.
If there's any doubt about the meaning of "Object value" it is
ultimately what is returned by the internal function ObjectCreate :
Sec 9.1.13 ObjectCreate(proto, internalSlotsList)
The abstract operation ObjectCreate with argument proto (an
object or null) is used to specify the runtime creation of new
ordinary objects.
...
2. Let obj be a newly created object with an internal slot for
each name in internalSlotsList.
...
6. Return obj.
I therefore assert that the ECMAScript Standard does *not* insist that
the values of e and f are Java-style references.
John
Back to comp.lang.javascript | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Trying to understand OOP (newbie to OOP) bit-naughty@hotmail.com - 2016-12-11 09:48 -0800
Re: Trying to understand OOP (newbie to OOP) Tim Slattery <tim@risingdove.com> - 2016-12-11 13:48 -0500
Re: Trying to understand OOP (newbie to OOP) Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2016-12-11 21:47 +0100
Re: Trying to understand OOP (newbie to OOP) John Harris <niam@jghnorth.org.uk.invalid> - 2016-12-12 10:40 +0000
Re: Trying to understand OOP (newbie to OOP) John Harris <niam@jghnorth.org.uk.invalid> - 2016-12-12 20:31 +0000
Re: Trying to understand OOP (newbie to OOP) Tim Streater <timstreater@greenbee.net> - 2016-12-12 21:46 +0000
Re: Trying to understand OOP (newbie to OOP) Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2016-12-13 13:51 +0100
Re: Trying to understand OOP (newbie to OOP) John Harris <niam@jghnorth.org.uk.invalid> - 2016-12-13 14:58 +0000
Re: Trying to understand OOP (newbie to OOP) Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2016-12-13 20:23 +0100
Re: Trying to understand OOP (newbie to OOP) John Harris <niam@jghnorth.org.uk.invalid> - 2016-12-14 16:42 +0000
Re: Trying to understand OOP (newbie to OOP) Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2016-12-14 19:26 +0100
Re: Trying to understand OOP (newbie to OOP) John Harris <niam@jghnorth.org.uk.invalid> - 2016-12-15 14:36 +0000
Re: Trying to understand OOP (newbie to OOP) John Harris <niam@jghnorth.org.uk.invalid> - 2016-12-14 16:52 +0000
Re: Trying to understand OOP (newbie to OOP) Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2016-12-14 19:27 +0100
Re: Trying to understand OOP (newbie to OOP) John Harris <niam@jghnorth.org.uk.invalid> - 2016-12-15 14:48 +0000
Re: Trying to understand OOP (newbie to OOP) "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2016-12-15 16:16 +0100
Re: Trying to understand OOP (newbie to OOP) Gene Wirchenko <genew@telus.net> - 2016-12-15 09:28 -0800
Re: Trying to understand OOP (newbie to OOP) "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2016-12-16 09:07 +0100
Re: Trying to understand OOP (newbie to OOP) Gene Wirchenko <genew@telus.net> - 2016-12-16 09:06 -0800
Re: Trying to understand OOP (newbie to OOP) "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2016-12-17 00:33 +0100
Re: Trying to understand OOP (newbie to OOP) John Harris <niam@jghnorth.org.uk.invalid> - 2016-12-16 10:47 +0000
Re: Trying to understand OOP (newbie to OOP) "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2016-12-16 17:12 +0100
Re: Trying to understand OOP (newbie to OOP) Dr J R Stockton <reply1600@merlyn.demon.co.uk.invalid> - 2016-12-17 20:40 +0000
Re: Trying to understand OOP (newbie to OOP) "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2016-12-18 10:45 +0100
Re: Trying to understand OOP (newbie to OOP) Dr J R Stockton <reply1600@merlyn.demon.co.uk.invalid> - 2016-12-19 19:15 +0000
Re: Trying to understand OOP (newbie to OOP) Andrew Poulos <ap_prog@hotmail.com> - 2016-12-20 13:13 +1100
Re: Trying to understand OOP (newbie to OOP) "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2016-12-20 11:39 +0100
Re: Trying to understand OOP (newbie to OOP) Andrew Poulos <ap_prog@hotmail.com> - 2016-12-21 07:03 +1100
Re: Trying to understand OOP (newbie to OOP) "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2016-12-21 00:07 +0100
Re: Trying to understand OOP (newbie to OOP) Scott Sauyet <scott@sauyet.com> - 2017-01-02 03:55 +0000
Re: Trying to understand OOP (newbie to OOP) "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2017-01-02 12:26 +0100
Re: Trying to understand OOP (newbie to OOP) Andrew Poulos <ap_prog@hotmail.com> - 2017-01-02 22:39 +1100
Re: Trying to understand OOP (newbie to OOP) "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2017-01-02 12:48 +0100
Re: Trying to understand OOP (newbie to OOP) Tim Streater <timstreater@greenbee.net> - 2017-01-02 11:42 +0000
Re: Trying to understand OOP (newbie to OOP) "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2017-01-02 12:53 +0100
Re: Trying to understand OOP (newbie to OOP) Andrew Poulos <ap_prog@hotmail.com> - 2017-01-03 12:02 +1100
Re: Trying to understand OOP (newbie to OOP) "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2017-01-03 11:36 +0100
Re: Trying to understand OOP (newbie to OOP) "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2016-12-20 11:37 +0100
Re: Trying to understand OOP (newbie to OOP) Gene Wirchenko <genew@telus.net> - 2016-12-19 09:43 -0800
Re: Trying to understand OOP (newbie to OOP) "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2016-12-19 19:55 +0100
Re: Trying to understand OOP (newbie to OOP) Gene Wirchenko <genew@telus.net> - 2016-12-19 16:05 -0800
Re: Trying to understand OOP (newbie to OOP) "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2016-12-20 11:28 +0100
Re: Trying to understand OOP (newbie to OOP) Gene Wirchenko <genew@telus.net> - 2016-12-20 09:44 -0800
Re: Trying to understand OOP (newbie to OOP) "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2016-12-21 00:03 +0100
Re: Trying to understand OOP (newbie to OOP) Tim Streater <timstreater@greenbee.net> - 2016-12-20 23:08 +0000
Re: Trying to understand OOP (newbie to OOP) "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2016-12-21 10:03 +0100
Re: Trying to understand OOP (newbie to OOP) Gene Wirchenko <genew@telus.net> - 2016-12-20 15:24 -0800
Re: Trying to understand OOP (newbie to OOP) "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2016-12-21 10:01 +0100
Re: Trying to understand OOP (newbie to OOP) Gene Wirchenko <genew@telus.net> - 2016-12-21 10:20 -0800
Re: Trying to understand OOP (newbie to OOP) "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2016-12-22 10:59 +0100
Re: Trying to understand OOP (newbie to OOP) Tim Slattery <tim@risingdove.com> - 2016-12-13 11:04 -0500
Re: Trying to understand OOP (newbie to OOP) Jon Ribbens <jon+usenet@unequivocal.eu> - 2016-12-13 16:16 +0000
Re: Trying to understand OOP (newbie to OOP) "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2016-12-13 17:26 +0100
Re: Trying to understand OOP (newbie to OOP) Scott Sauyet <scott@sauyet.com> - 2017-01-02 03:58 +0000
Re: Trying to understand OOP (newbie to OOP) JJ <jj4public@vfemail.net> - 2016-12-12 12:29 +0700
Re: Trying to understand OOP (newbie to OOP) Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2016-12-12 16:12 +0100
Re: Trying to understand OOP (newbie to OOP) Scott Sauyet <scott@sauyet.com> - 2016-12-13 02:06 +0000
Re: Trying to understand OOP (newbie to OOP) bit-naughty@hotmail.com - 2016-12-14 09:33 -0800
Re: Trying to understand OOP (newbie to OOP) "Christoph M. Becker" <cmbecker69@arcor.de> - 2016-12-14 18:47 +0100
Re: Trying to understand OOP (newbie to OOP) Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2016-12-14 22:07 +0100
Re: Trying to understand OOP (newbie to OOP) Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2016-12-14 22:17 +0100
csiph-web