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


Groups > comp.lang.javascript > #31799 > unrolled thread

Trying to understand OOP (newbie to OOP)

Started bybit-naughty@hotmail.com
First post2016-12-11 09:48 -0800
Last post2016-12-14 22:17 +0100
Articles 20 on this page of 61 — 13 participants

Back to article view | Back to comp.lang.javascript


Contents

  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

Page 1 of 4  [1] 2 3 4  Next page →


#31799 — Trying to understand OOP (newbie to OOP)

Frombit-naughty@hotmail.com
Date2016-12-11 09:48 -0800
SubjectTrying to understand OOP (newbie to OOP)
Message-ID<71f4511f-db38-48ba-82cb-939e378a8553@googlegroups.com>
What does TWO dots mean in Javascript, exactly? Like, e.style.fontSize - e is an object, right? And then?

[toc] | [next] | [standalone]


#31801

FromTim Slattery <tim@risingdove.com>
Date2016-12-11 13:48 -0500
Message-ID<8p7r4cpiv3m5qj1b8coo1jfulhccr4fv05@4ax.com>
In reply to#31799
bit-naughty@hotmail.com wrote:

>What does TWO dots mean in Javascript, exactly? Like, e.style.fontSize - e is 
>an object, right? And then?

"e" is an object. "style" is another object that's part of "e". And
"fontSize" is an attribute of "style".

-- 
Tim Slattery
tim <at> risingdove <dot> com

[toc] | [prev] | [next] | [standalone]


#31803

FromThomas 'PointedEars' Lahn <PointedEars@web.de>
Date2016-12-11 21:47 +0100
Message-ID<5769635.4vTCxPXJkl@PointedEars.de>
In reply to#31801
Tim Slattery wrote:

> bit-naughty@hotmail.com wrote:
>>What does TWO dots mean in Javascript, exactly? Like, e.style.fontSize - e
>>is an object, right? And then?
> 
> "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.  Here, that 
value is (has to be) a reference to another object.

That object has a property named “style”.¹  That property has a value.
That value is a reference to yet another object.

That object has a property named “fontSize”.¹  That property has a value.  

That value is a string (sequence) of characters (data type: String).  That 
value is not a reference to an object; it is a primitive value (typeof value 
=== "string"; therefore written “string” here instead):

           ,-----------------.
    e ---> : object[Element] :
           :-----------------:    ,-----------------------------.
           : style : object ----> : object[CSSStyleDeclaration] :
           : ...             :    :-----------------------------:
           `-----------------'    : fontSize : string           :
                                  : ...                         :
                                  `-----------------------------'

But the string value can be converted to an object if necessary.  Then the 
implementation will convert (or handle it as if it converted) internally the 
value to an object (here: a String instance), and return a reference to that 
object; so that property accesses like

  e.style.fontSize.indexOf("px")

are possible.

                            ,------------------------------------.
    Object.prototype -----> : object[Function]                   :
                            :------------------------------------:
                            : ...                                :
                            : +hasOwnProperty(:String) : boolean :
                            : ...                                :
                            : +toString() : string               :
                            : +valueOf()                         :
                            : ...                                :
                            `------------------------------------'
                                          ^
                                          :
                            ,----------------------------.
    String.prototype -----> : object[Function]           :
                            :----------------------------:
                            : ...                        :
                            : +indexOf(:String) : number :
                            : ...                        :
                            : +toString() : string       :
                            : +valueOf() : string        :
                            : ...                        :
                            `----------------------------'
                                          ^
                                          :
                            ,----------------------------.
    (e.style.fontSize) ---> : object[String]             :
                            :----------------------------:
                            : length : number            :
                            `----------------------------'

    Legend: X ---> Y  The value of X is a reference to Y

               Y
               ^
               :     X inherits from Y (direction of prototype chain)
               X

              +X     X is the name of a (public) method  } see also
              X:Y    The (expected) data type of X is Y  } UML(2)

_________
¹  It has that property because it implements an (DOM) interface that
   specifies a corresponding attribute.
-- 
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.

[toc] | [prev] | [next] | [standalone]


#31810

FromJohn Harris <niam@jghnorth.org.uk.invalid>
Date2016-12-12 10:40 +0000
Message-ID<bivs4c1qa1oqrfb3v6tv5gek0gpoo3d2s1@4ax.com>
In reply to#31803
On Sun, 11 Dec 2016 21:47:01 +0100, Thomas 'PointedEars' Lahn
<PointedEars@web.de> wrote:

  <snip>
>Whatever it is the identifier/name of, this entity has a value.  Here, that 
>value is (has to be) a reference to another object.

What Thomas is trying to say is that some ECMAScript implementations
use Java-style references to do this job, even though the ECMAScript
Standard does not insist that they do it that way.


>That object has a property named “style”.¹  That property has a value.
>That value is a reference to yet another object.
  <snip>

Ditto.

  John

[toc] | [prev] | [next] | [standalone]


#31824

FromJohn Harris <niam@jghnorth.org.uk.invalid>
Date2016-12-12 20:31 +0000
Message-ID<152u4c5l9g1c3og69evu3nre4ov14c3is6@4ax.com>
In reply to#31803
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.


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

  John

[toc] | [prev] | [next] | [standalone]


#31826

FromTim Streater <timstreater@greenbee.net>
Date2016-12-12 21:46 +0000
Message-ID<121220162146464045%timstreater@greenbee.net>
In reply to#31824
In article <152u4c5l9g1c3og69evu3nre4ov14c3is6@4ax.com>, John Harris
<niam@jghnorth.org.uk.invalid> 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.

You are overlooking that PointyHead is Humpty Dumpty. And don't forget
what the White Knight (IIRC) had to say on the matter.

-- 
"The problem with defending the purity of the English language is that English
is about as pure as a cribhouse whore. We don't just borrow words; on occasion,
English has pursued other languages down alleyways to beat them unconscious 
and rifle their pockets for new vocabulary."            -- James Nicoll, rasfw

[toc] | [prev] | [next] | [standalone]


#31835

FromThomas 'PointedEars' Lahn <PointedEars@web.de>
Date2016-12-13 13:51 +0100
Message-ID<11687593.uLZWGnKmhe@PointedEars.de>
In reply to#31824
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…
 
>   <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>

  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?

-- 
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.

[toc] | [prev] | [next] | [standalone]


#31836

FromJohn Harris <niam@jghnorth.org.uk.invalid>
Date2016-12-13 14:58 +0000
Message-ID<31305chjkk5nk6utdqkqt6hu4g0b7h9fke@4ax.com>
In reply to#31835
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.

 
>>   <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.

>  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. I'll say that again
as you didn't seem to understand it the first few times : it's the
*implementation* that causes it to do what the ECMAScript Standard
says it must appear to do.

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.

  John

[toc] | [prev] | [next] | [standalone]


#31843

FromThomas 'PointedEars' Lahn <PointedEars@web.de>
Date2016-12-13 20:23 +0100
Message-ID<3306468.kQq0lBPeGt@PointedEars.de>
In reply to#31836
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.

[toc] | [prev] | [next] | [standalone]


#31858

FromJohn Harris <niam@jghnorth.org.uk.invalid>
Date2016-12-14 16:42 +0000
Message-ID<5ft25c55r32vip25tukphfp7qe5hp89f14@4ax.com>
In reply to#31843
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

[toc] | [prev] | [next] | [standalone]


#31866

FromThomas 'PointedEars' Lahn <PointedEars@web.de>
Date2016-12-14 19:26 +0100
Message-ID<1913588.Icojqenx9y@PointedEars.de>
In reply to#31858
John Harris wrote:

> 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?

Because (type conversion with “==” notwithstanding; use “===” to avoid this 
condition for anything but +0 vs. -0) “e” and “f” hold the same value.  In 
this case they hold the same reference value, which is therefore referring 
to the same object.  Or, more loosely speaking, they *refer* to the same 
object (but they *are* _not_ objects).  That was easy.

Here is another example:

  var o = {};
  (function (p) { p.answer = 42; }(o));

  /* 42 */
  console.log(o.answer);

If an object (value) would be passed/copied here instead of an object 
reference (value), then “o.answer” would not yield “42”.  Because there is 
no call-by-reference in these languages, only call-by-value, and “p” is a 
local symbol.  (And to assume that the implementation is required to make 
the link from “p” to “o” outside the local execution context, as you did 
before, is outright ridiculous.)

> Let us see what the relevant bits of the current ECMAScript Standard (6th
> ed) say.

Current is the 7th edition, ECMAScript 2016:

<http://ecma-international.org/publications/standards/Ecma-262.htm>

And there have been implementations of editions before that; so, at most, 
what you are quoting applies to previous-to-current versions of 
implementations.
 
> […]
> 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.

First of all, wrong section for this code.
 
> 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.

Second, there is no definition of “Object value” there.

Third, you could have realized by now that this is deliberately *abstract* 
language and implementations do not follow this to the letter.  Oh wait, 
you did, but only *when it fit your argument*.

“Learn to know what is from what seems to be, and what you wish to be.”
 
> I therefore assert that the ECMAScript Standard does *not* insist that
> the values of e and f are Java-style references.

Nor does it say the opposite.  And Java is by far not the only object-
oriented programming language, nor was it the first of its kind, in which 
objects are handled with references to them.

You just have to start looking above your limited C++ horizon – one 
hopes that this is the reason for your fairytales – where an assignment 
between variables *declared* to be of an object type means something very 
different, and objects are handled very differently (I am just saying 
“object slicing”).

Because it simply does not make sense for an *efficient* implementation to 
create more than one object here inasfar as to allocate memory for the same 
data multiple times *by default* (and you have to go to great lengths to 
really *clone* an object in the languages we are discussing here).  
Especially not when a program is running *within the constraints of 
another*, the Web browser/HTML UA originally.  It makes much more sense to 
pass reference/pointer values around, compare those, and dereference them 
when necessary (property access).  Occam’s Razor.

But go ahead, do memory benchmarks and UTSL, and surprise me with an actual 
finding (instead of your claims based on misconceptions and gut feelings) 
that any implementation of ECMAScript allocates memory for more than one 
*Object* instance here, that it keeps a registry which variable referred to 
which instead of handling references to objects.  Because that would be 
required for your idea to even resemble reality.

I can already tell you one implementation of ECMAScript to which your idea 
does not apply: Mozilla JavaScript.

Hopefully you will *finally* see the light after reading

<https://developer.mozilla.org/en-US/docs/Web/JavaScript/Memory_Management>

(_not_ written by me.)

-- 
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.

[toc] | [prev] | [next] | [standalone]


#31873

FromJohn Harris <niam@jghnorth.org.uk.invalid>
Date2016-12-15 14:36 +0000
Message-ID<qga55cldh7cba5lls6cd6d2d3uoqo0pvih@4ax.com>
In reply to#31866
On Wed, 14 Dec 2016 19:26:12 +0100, Thomas 'PointedEars' Lahn
<PointedEars@web.de> wrote:

>John Harris wrote:
>
>> 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>
>> Why does the term  e == f  evaluate to true here?
>
>Because (type conversion with “==” notwithstanding; use “===” to avoid this 
>condition for anything but +0 vs. -0) “e” and “f” hold the same value.  In 
>this case they hold the same reference value, 
  <snip

Where in any edition of ECMA 262 does it say they hold a "reference
value" ?


  <snip>
>> Let us see what the relevant bits of the current ECMAScript Standard (6th
>> ed) say.
>
>Current is the 7th edition, ECMAScript 2016:

Thank you for bringing that to our attention. As it happens, although
several sections have been renumbered and one split in two since the
6th edition, the text that is relevant here has not changed.


>> […]
>> 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.
>
>First of all, wrong section for this code.

7.2.13 Abstract Equality Comparison calls 7.2.14 Strict Equality
Comparison which now calls 7.2.11 SameValueNonNumber, so it is the
right section for this code, as should have been obvious.

 
>> 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.
>
>Second, there is no definition of “Object value” there.

I wrote "ultimately". There is a long, long list of specification
functions that copy obj. Eventually it is this that is copied into the
values of e and f and retrieved during evaluation of  e == f.

There is no place where obj is described as being replaced by
'reference to obj'.


>Third, you could have realized by now that this is deliberately *abstract* 
>language and implementations do not follow this to the letter.  

I've been saying that its the Standard's language for months now. I've
also mentioned the obvious : that an implementations job is to
implement it in a way that can't be distinguished from what the
Standard says.


>Oh wait, 
>you did, but only *when it fit your argument*.

But what you haven't understood yet is that one way to implement it is
not the only way. Therefore it is wrong to discourage people from
using the Standard's language.

Or have you proved beyond all possible doubt that no-one in the
Universe can possibly think up another way to implement it. Even if
you have it's wrong to move people away from the Standard's language.


  <snip>
>Because it simply does not make sense for an *efficient* implementation to 

There you go - implementation.


  <snip>
><https://developer.mozilla.org/en-US/docs/Web/JavaScript/Memory_Management>

That page uses a different meaning of "reference".


HTH
  John

[toc] | [prev] | [next] | [standalone]


#31859

FromJohn Harris <niam@jghnorth.org.uk.invalid>
Date2016-12-14 16:52 +0000
Message-ID<n5u25chvpdd8sr8p4h66k68aeo23mf8j7f@4ax.com>
In reply to#31843
On Tue, 13 Dec 2016 20:23:35 +0100, Thomas 'PointedEars' Lahn
<PointedEars@web.de> wrote:

  <snip>
>    [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.]

[Note to readers(2): This is Thomas Lahn's way of continuing a
 technical discussion. Hey, Ho.]

(2) with thanks to no-one.

  John

[toc] | [prev] | [next] | [standalone]


#31867

FromThomas 'PointedEars' Lahn <PointedEars@web.de>
Date2016-12-14 19:27 +0100
Message-ID<98803868.nniJfEyVGO@PointedEars.de>
In reply to#31859
John Harris wrote:

> On Tue, 13 Dec 2016 20:23:35 +0100, Thomas 'PointedEars' Lahn
> <PointedEars@web.de> wrote:
>   <snip>
>>    [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.]
> 
> [Note to readers(2): This is Thomas Lahn's way of continuing a
>  technical discussion. Hey, Ho.]
> 
> (2) with thanks to no-one.

There, you are doing it again.  And you really wonder why I cannot take you 
seriously?

-- 
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.

[toc] | [prev] | [next] | [standalone]


#31874

FromJohn Harris <niam@jghnorth.org.uk.invalid>
Date2016-12-15 14:48 +0000
Message-ID<35b55chbl8b6h6ns3r0e4ecrn4fm58q8sv@4ax.com>
In reply to#31843
On Tue, 13 Dec 2016 20:23:35 +0100, Thomas 'PointedEars' Lahn
<PointedEars@web.de> wrote:

  <snip>
>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>

Wrong. I'd be delighted. Unfortunately it seems that you don't know
what ad hominem is, so here is a little tutorial.

An example of an ad hominem argument would be
  You are a fool, *therefore* you are wrong.

An example that is not would be
  You are a fool *and* you are wrong.
This is not an ad hominem argument, simply because it is not an
argument. It is a plain statement. It is possibly a minority opinion,
possibly malicious, or, indeed, possibly the opinion of nearly
everyone. 

  John

[toc] | [prev] | [next] | [standalone]


#31875

From"Evertjan." <exxjxw.hannivoort@inter.nl.net>
Date2016-12-15 16:16 +0100
Message-ID<XnsA6DFA5882E690eejj99@194.109.6.166>
In reply to#31874
John Harris <niam@jghnorth.org.uk.invalid> wrote on 15 Dec 2016 in 
comp.lang.javascript:

> <PointedEars@web.de> wrote:
> 
>   <snip>
>> 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>
> 
> Wrong. I'd be delighted. Unfortunately it seems that you don't know
> what ad hominem is, so here is a little tutorial.
> 
> An example of an ad hominem argument would be
>   You are a fool, *therefore* you are wrong.
> 
> An example that is not would be
>   You are a fool *and* you are wrong.
> This is not an ad hominem argument, simply because it is not an
> argument. It is a plain statement. It is possibly a minority opinion,
> possibly malicious, or, indeed, possibly the opinion of nearly
> everyone. 

Wrong! 

You cannot define something by examples.

A [good, imho] definition of "ad hominem" is:

Attacking your opponent's character or personal traits in an attempt to 
undermine their argument.



-- 
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)

[toc] | [prev] | [next] | [standalone]


#31876

FromGene Wirchenko <genew@telus.net>
Date2016-12-15 09:28 -0800
Message-ID<9fk55cpqkfn5chs6mqovlo8ppcqcd9ufam@4ax.com>
In reply to#31875
On Thu, 15 Dec 2016 16:16:20 +0100, "Evertjan."
<exxjxw.hannivoort@inter.nl.net> wrote:

>John Harris <niam@jghnorth.org.uk.invalid> wrote on 15 Dec 2016 in 
>comp.lang.javascript:
>
>> <PointedEars@web.de> wrote:
>> 
>>   <snip>
>>> 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>
>> 
>> Wrong. I'd be delighted. Unfortunately it seems that you don't know
>> what ad hominem is, so here is a little tutorial.
>> 
>> An example of an ad hominem argument would be
>>   You are a fool, *therefore* you are wrong.
>> 
>> An example that is not would be
>>   You are a fool *and* you are wrong.
>> This is not an ad hominem argument, simply because it is not an
>> argument. It is a plain statement. It is possibly a minority opinion,
>> possibly malicious, or, indeed, possibly the opinion of nearly
>> everyone. 

     Nicely written, sir!

>Wrong! 
>
>You cannot define something by examples.

     Sure you can.  You just have to get all of the examples.  It is
called an extensional definition.  See
          https://en.wikipedia.org/wiki/Extensional_definition

>A [good, imho] definition of "ad hominem" is:
>
>Attacking your opponent's character or personal traits in an attempt to 
>undermine their argument.

     And Mr. Harris's examples make the distinction.

Sincerely,

Gene Wirchenko

[toc] | [prev] | [next] | [standalone]


#31880

From"Evertjan." <exxjxw.hannivoort@inter.nl.net>
Date2016-12-16 09:07 +0100
Message-ID<XnsA6E05CD85EC20eejj99@194.109.6.166>
In reply to#31876
Gene Wirchenko <genew@telus.net> wrote on 15 Dec 2016 in 
comp.lang.javascript:

>>You cannot define something by examples.
> 
>      Sure you can.  You just have to get all of the examples.  It is
> called an extensional definition.  See
>           https://en.wikipedia.org/wiki/Extensional_definition

This is essentially nonsense, because then you would have to define the 
concept as limited to the examples, [the limitation of the 'extension'], 
which part of the definition is not an example in itself.

>>>A [good, imho] definition of "ad hominem" is:
>>
>> Attacking your opponent's character or personal traits in an attempt to
>> undermine their argument.

>  And Mr. Harris's examples make the distinction.

What distinction?

Using "ad hominem" is both a vile and a falacious argumentation.

-- 
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)

[toc] | [prev] | [next] | [standalone]


#31886

FromGene Wirchenko <genew@telus.net>
Date2016-12-16 09:06 -0800
Message-ID<kh785cphvrvundqvnvc03eh53o2tb4moit@4ax.com>
In reply to#31880
On Fri, 16 Dec 2016 09:07:37 +0100, "Evertjan."
<exxjxw.hannivoort@inter.nl.net> wrote:

>Gene Wirchenko <genew@telus.net> wrote on 15 Dec 2016 in 
>comp.lang.javascript:
>
>>>You cannot define something by examples.
>> 
>>      Sure you can.  You just have to get all of the examples.  It is
>> called an extensional definition.  See
>>           https://en.wikipedia.org/wiki/Extensional_definition
>
>This is essentially nonsense, because then you would have to define the 
>concept as limited to the examples, [the limitation of the 'extension'], 
>which part of the definition is not an example in itself.

     Of course, the concept is limited to the examples.  That is the
way the extensional definitions work, being definition by examples. If
there were not enough examples, then the definition is not complete.
Extensional definitions work just fine with limited sets such even
primes and single-digit squares.

>>>>A [good, imho] definition of "ad hominem" is:
>>>
>>> Attacking your opponent's character or personal traits in an attempt to
>>> undermine their argument.
>
>>  And Mr. Harris's examples make the distinction.
>
>What distinction?

     The distinction between argument and arguer.

>Using "ad hominem" is both a vile and a falacious argumentation.

     A good thing that we are not using it then, eh?

Sincerely,

Gene Wirchenko

[toc] | [prev] | [next] | [standalone]


#31888

From"Evertjan." <exxjxw.hannivoort@inter.nl.net>
Date2016-12-17 00:33 +0100
Message-ID<XnsA6E15C06499Aeejj99@194.109.6.166>
In reply to#31886
Gene Wirchenko <genew@telus.net> wrote on 16 Dec 2016 in 
comp.lang.javascript:

>>Using "ad hominem" is both a vile and a falacious argumentation.
> 
>      A good thing that we are not using it then, eh?

Right you are!

-- 
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)

[toc] | [prev] | [next] | [standalone]


Page 1 of 4  [1] 2 3 4  Next page →

Back to top | Article view | comp.lang.javascript


csiph-web