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


Groups > comp.lang.javascript > #31843

Re: Trying to understand OOP (newbie to OOP)

From Thomas 'PointedEars' Lahn <PointedEars@web.de>
Newsgroups comp.lang.javascript
Subject Re: Trying to understand OOP (newbie to OOP)
Date 2016-12-13 20:23 +0100
Organization PointedEars Software (PES)
Message-ID <3306468.kQq0lBPeGt@PointedEars.de> (permalink)
References (1 earlier) <8p7r4cpiv3m5qj1b8coo1jfulhccr4fv05@4ax.com> <5769635.4vTCxPXJkl@PointedEars.de> <152u4c5l9g1c3og69evu3nre4ov14c3is6@4ax.com> <11687593.uLZWGnKmhe@PointedEars.de> <31305chjkk5nk6utdqkqt6hu4g0b7h9fke@4ax.com>

Show all headers | View raw


John Harris wrote:

> On Tue, 13 Dec 2016 13:51:28 +0100, Thomas 'PointedEars' Lahn
> <PointedEars@web.de> wrote:
>>John Harris wrote:
>>> On Sun, 11 Dec 2016 21:47:01 +0100, Thomas 'PointedEars' Lahn
>>> <PointedEars@web.de> wrote:
>>>>Tim Slattery wrote:
>>> 
>>> Tim Slattery is an identifier. Identifiers do not write Usenet
>>> articles; people do. Therefore
>>>   Tim Slattery wrote:
>>> should be
>>>   A person named Tim Slattery wrote:
>>> 
>>> At least, that's what Thomas says below.
>>
>>Just when I thought that your arguments could not get more ridiculous…
> 
> As you don't say which arguments you are talking about no-one knows
> what you are trying to say.

Do you really want the ugliness of all the ad-hominem nonsense you posted 
here over the years exposed?  I don’t think so.

>>>   <snip>
>>>>> "e" is an object. "style" is another object that's part of "e". And
>>>>> "fontSize" is an attribute of "style".
>>>>
>>>>No, that is a common misconception.
>>>>
>>>>?e? is the identifier of a variable or a formal parameter in an
>>>>enclosing execution context, or the name of a property of an object in
>>>>the scope chain.
>>> 
>>>>Whatever it is the identifier/name of, this entity has a value.
>>>   <snip>
> 
> It is conventional in Usenet to quote the article you are replying to,
> not an article on a different subject.

No, it is conventional in Usenet to quote what one is referring to, which I 
did.
 
>>  var e = {};
>>  var f = e;
>>  var g = e;
>>
>>  /* true true true */
>>  console.log(e == f, f == g, e == g);
>>
>>  /* undefined undefined undefined */
>>  console.log(e.foo, f.foo, g.foo);
>>
>>  e.foo = 42;
>>
>>  /* 42 42 42 */
>>  console.log(e.foo, f.foo, g.foo);
>>
>>What is the "magic" that allowed the three "objects" "e", "f", and "g",
>>that by your understanding must exist here, to learn of the change of each
>>other’s properties?
> 
> It's not magic, you fool, it's the implementation.

Once again *you* are the fool.  I put the text in quotes deliberately.

Because there is no magic, as there are no objects named "e", "f", and "g".  

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*:

  var e = {};

                          ,----------------------.
    Object.prototype ---> : [object Object]      :
                          :----------------------:
                          :----------------------:
                          : …                    :
                          : +toString() : String :
                          : +valueOf() : Object  :
                          : …                    :
                          `----------------------'
                                     ^
                                     :
                            ,-----------------.
    e --------------------> : [object Object] :
                            :-----------------:
                            `-----------------'

  var f = e;

                          ,----------------------.
    Object.prototype ---> : [object Object]      :
                          :----------------------:
                          :----------------------:
                          : …                    :
                          : +toString() : String :
                          : +valueOf() : Object  :
                          : …                    :
                          `----------------------'
                                     ^
                                     :
                            ,-----------------.
    e --------------------> : [object Object] : <-------------------- f
                            :-----------------:
                            `-----------------'
  var g = e;


                          ,----------------------.
    Object.prototype ---> : [object Object]      :
                          :----------------------:
                          :----------------------:
                          : …                    :
                          : +toString() : String :
                          : +valueOf() : Object  :
                          : …                    :
                          `----------------------'
                                     ^
                                     :
                            ,-----------------.
    e --------------------> : [object Object] : <-------------------- f
                            :-----------------: <-------------------- g
                            `-----------------'

  e.foo = 42;

                          ,----------------------.
    Object.prototype ---> : [object Object]      :
                          :----------------------:
                          :----------------------:
                          : …                    :
                          : +toString() : String :
                          : +valueOf() : Object  :
                          : …                    :
                          `----------------------'
                                     ^
                                     :
                           ,--------------------.
    e -------------------> : [object Object]    : <------------------- f
                           :--------------------: <------------------- g
                           : +foo : Number = 42 :
                           `--------------------'

And after

  e = null

we have only

                          ,----------------------.
    Object.prototype ---> : [object Object]      :
                          :----------------------:
                          :----------------------:
                          : …                    :
                          : +toString() : String :
                          : +valueOf() : Object  :
                          : …                    :
                          `----------------------'
                                     ^
                                     :
                           ,--------------------.
    e = null               : [object Object]    : <------------ f
                           :--------------------: <------------ g
                           : +foo : Number = 42 :
                           `--------------------'

and _not_

                          ,----------------------.
    Object.prototype ---> : [object Object]      :
                          :----------------------:
                          :----------------------:
                          : …                    :
                          : +toString() : String :
                          : +valueOf() : Object  :
                          : …                    :
                          `----------------------'
                                     ^
                                     :
                           ,--------------------.
    e = null               : [object Object]    :               f = null
                           :--------------------:               g = null
                           : +foo : Number = 42 :
                           `--------------------'

But we will have the latter if we also execute

  f = null;
  g = null;

As there are no more references to the object then, it can be marked for 
garbage collection.

Internally, a pointer value addressing the same location in heap memory may 
have been copied on the first assignment to achieve the former and a null 
pointer to achieve the latter, but that is neither required nor an 
implementation necessity (for example, there is Mozilla Rhino, 
an implementation of ECMAScript in Java, where there are no pointers in 
the implementation language); therefore one does not use the term “pointer” 
for this.

Objects have *identity*, not name.

> I'll say that again as you didn't seem to understand it the first few
> times :

ROTFL.  What do you dream of at night?

> it's the *implementation* that causes it to do what the ECMAScript
> Standar says it must appear to do.

You have still not the slightest clue what "the ECMAScript Standard" says.  
Specifically, it does _not_ say that objects implicitly share their 
properties when they are assigned to one another.  But that would be 
necessary to explain this if one assumed that “e”, “f”, and “g” really 
*were* objects or would have an object has their value, and were not just – 
as it actually is – identifiers of variables with a value which is a 
reference to one and the same object.  A value that *can change*.

> What must it appear to do? It must appear that exactly the same object
> is the value of e, and of f, and of g.

And if Santa Claus does not bring you gifts this year, it is because 
Mrs. Claus fed him too well, and he did not make it through the chimney :->

    [Note to readers¹: John Harris is among the most persistent idiots
     around here.  He has been trolling and repeating such nonsense for many
     years, without any attempt to learn the subject he tries to write
     about.  I reply to him only occasionally, as a service to readers who
     may not recognize his mistakes.  He has proven himself to be unable
     and unwilling to learn anything.]

_______
¹  with thanks to Tom Roberts, a physicist posting in sci.physics.ALL
-- 
PointedEars
FAQ: <http://PointedEars.de/faq> | <http://PointedEars.de/es-matrix>
<https://github.com/PointedEars> | <http://PointedEars.de/wsvn/>
Twitter: @PointedEars2 | Please do not cc me./Bitte keine Kopien per E-Mail.

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


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