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


Groups > comp.lang.javascript > #33652

Re: Not understanding OOP stuff

Path csiph.com!weretis.net!feeder4.news.weretis.net!news.mb-net.net!open-news-network.org!.POSTED.32.229.197.178.dynamic.wless.zhbmb00p-cgnat.res.cust.swisscom.ch!not-for-mail
From Thomas 'PointedEars' Lahn <PointedEars@web.de>
Newsgroups comp.lang.javascript
Subject Re: Not understanding OOP stuff
Date Mon, 24 Jul 2017 16:04:04 +0200
Organization PointedEars Software (PES)
Lines 122
Message-ID <8120403.CDJkKcVGEf@PointedEars.de> (permalink)
References <dc1ffbaa-0933-47cd-b0dd-969f7927ed03@googlegroups.com> <objects-20170721181824@ram.dialup.fu-berlin.de> <1914438.irdbgypaU6@PointedEars.de> <thhbncpt8m1r013t01pqspdefb1riehgmt@4ax.com>
Reply-To Thomas 'PointedEars' Lahn <cljs@PointedEars.de>
Mime-Version 1.0
Content-Type text/plain; charset="UTF-8"
Content-Transfer-Encoding 8Bit
Injection-Info gwaiyur.mb-net.net; posting-host="32.229.197.178.dynamic.wless.zhbmb00p-cgnat.res.cust.swisscom.ch:178.197.229.32"; logging-data="10972"; mail-complaints-to="abuse@open-news-network.org"
User-Agent KNode/4.14.2
Face iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAGFBMVEXTxa4RFk5dUWANED8PFEfy7+MGBiW+n3ZNF/QuAAACaElEQVQ4jVXUwVOcMBQG8Dc7Rc4PUntdWV2uxjDpGaGeozOp1woar4jd5t/v9wLstMwsA/ntlxdCAgUc1hjTc9/JCZfGoo3wG3HdmdAWrIJRHe7GM/TmpY5VFefuVcAkkPbLIaN8rmPmjloyZxgyR3GuJ4K0AGtJ2htz8o7yqikm759fldQXaMpbDzjKAG+8v+AugVTOPO5DOjLvGtUYQwh0CPjnVMyGd+8/GfUB5nLKJDD2aLDh5HYyMDJGDwQIo2ZmZcKbowNmAdB/AzyFhrmF2MHRb0QJJfaAnwGB6orZhoykLzJtGwF/xpYxI1dswomiUj3gTuAIqCn/4C7cULwGNBtwMTk3Y4LfKB5YUaOKBKYtpplm7u0vip8tU1NWWyI/7XdcSuIDoMt6rVHMWT0DbjHPGqDqZVSa6zleLcUTcIKLoMv3ueJluALtAo9B302zPPlrtiVScRdCjXvVh3e3JpYa/jjkuC9N+LrBMlz/eAN4eQijX2EdLo6c5tGGHwLyHFtXk89dDGHwCVhG9T0S/j55AhRZgkMCmUQXJ49TnS1wnQDvw0eAh9ICeMmEFbCnPMFzjAvsWoEWEFdYEx+S0MoUZ1gT1wId8+AF3Bl2OoEu906AUHx5VLw/gXYg/x84loOah/2UYNrgiwSwGO7RfUzVBbx/kgpckumGOi6QirtD6gkLTitbnxNol47S2jVc2vsN5kPqaAHT8uUdAJM4v/DanjYOwmUjWznGfwB7sGtAtor5BgofDuzaRj4kSQAqDakTsKORa3Q3xKi3gE1fhl71KRMqrdZ2AWNNg/YOhQyrVBnb+i+nEg4bsDA+egAAAABJRU5ErkJggg==
X-User-ID U2FsdGVkX1+57uKIwVDaTtQW0CtJLC/r653Hw55vuvM288g+aNE4wQ==
Cancel-Lock sha1:aQzfJni8SwpCyKzE8W7diFGszxI=
X-Face %i>XG-yXR'\"2P/C_aO%~;2o~?g0pPKmbOw^=NT`tprDEf++D.m7"}HW6.#=U:?2GGctkL,f89@H46O$ASoW&?s}.k+&.<b';Md8`dH6iqhT)6C^.Px|[=M@7=Ik[_w<%n1Up"LPQNu2m8|L!/3iby{-]A+#YE}Kl{Cw$\U!kD%K}\2jz"QQP6Uqr],./"?;=4v
Xref csiph.com comp.lang.javascript:33652

Show key headers only | View raw


John G Harris wrote:

> On Sun, 23 Jul 2017 18:12:10 +0200, Thomas 'PointedEars' Lahn
> <PointedEars@web.de> wrote:
>>Stefan Ram wrote:
>>> bit-naughty@hotmail.com writes:
>>>> Is "addEventListener" INSIDE it or something? How is that possible?
>>> 
>>>   Yes.
>>
>>N-O.
>>
>>>   Objects can contain methods.
>>
>>N-O.
> 
> We all know that software does not have insides and outsides. But
> software can implement conceptual things that do have insides and
> outsides. If anyone wants to think of an ECMAScript object as
> something that contains properties then they are not wrong. What would
> be wrong is criticising them for this view.

There is a difference between saying “an object contains a property” and
“an object contains a method”.

In ECMAScript 2016, § “4.2 ECMAScript Overview”:

,-<http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-overview>
| 
| […] a function is a callable object.  A function that is associated with
                                                           ^^^^^^^^^^^^^^^
| an object via a property is called a /method/.
| 
| […]
| 4.3.30 property
| 
| part of an object that associates a key (either a String value or a Symbol 
| value) and a value
| […]
| 
| 4.3.31 method
| 
| function that is the value of a property
| […]

Section 4 “contains a non-normative overview of the ECMAScript Language”, 
but there are no other explicit definitions for “method” in any Edition of 
the Specification, so this is as best as it gets.

However, given the number of occurrences where it is being said that an 
object “_has_ a property”, including names such as “hasOwnProperty”, 
I (among others) prefer and recommend to use *that* wording instead.

    [The same goes for “references”: the fact that the modification of the 
     properties of an object #1 can simultaneously affect the properties of 
     two distinct other objects #2 and #3 is easier to understand if one 
     does not assume that object #1 is the value of both the property of 
     objects #2 and #3, and somehow object #1 is contained in both objects 
     #2 and #3, but is being referred to by the value of their properties      
     (reference value).  Which also comes closer to what is mostly being 
     implemented (a property name maps to a pointer value referring a memory
     area where object data is stored).]

>> Objects *in ECMAScript implementations* can have *properties* whose
>> value is a reference to a callable object;
> 
> ... whose value is an object with a [[Call]] internal method; ...
> 
> Please use the terminology specified in ECMA 262.

You do not know “ECMA 262” as well as you think you do (you do not even know 
that it is properly written _ECMA-262_, and then the term is still imprecise 
due to the several Editions).

The term “callable object” is not my invention.  See above, and e.g. 
ECMAScript 2016, § “6.1.7.2 Object Internal Methods and Internal Slots”:

,-<http://www.ecma-international.org/ecma-262/7.0/#table-6>
| 
| Table 6: Additional Essential Internal Methods of Function Objects
| 
| Internal Method	Signature                     Description
| ------------------------------------------------------------------------
| [[Call]]	(any, a List of any) → any	Executes code associated 
|                                                 with this object. Invoked
|                                                 via a function call 
|                                                 expression. The arguments 
|                                                 to the internal method are 
|                                                 a *this* value and a list 
|                                                 containing the arguments 
|                                                 passed to the function by 
|                                                 a call expression. Objects 
                                                  ^^^^^^^^^^^^^^^^^^^^^^^^^^
|                                                 that implement this 
                                                  ^^^^^^^^^^^^^^^^^^^
|                                                 internal method are
                                                  ^^^^^^^^^^^^^^^^^^^                                                 
|                                                 /callable/.
                                                  ^^^^^^^^^^^

Moreover, you have failed to realize that those internal methods and slots 
are purely specification mechanisms:

| 6.1.7.2 Object Internal Methods and Internal Slots
| 
| The actual semantics of objects, in ECMAScript, are specified via 
| algorithms called internal methods. Each object in an ECMAScript engine is 
| associated with a set of internal methods that defines its runtime 
| behaviour. These internal methods are not part of the ECMAScript language. 
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| They are defined by this specification purely for expository purposes. 
  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| However, each object within an implementation of ECMAScript must behave as 
| specified by the internal methods associated with it. The exact manner in 
| which this is accomplished is determined by the implementation.

(*That* section, “6 ECMAScript Data Types and Values”, *is* normative.)

-- 
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 | Next — Previous in thread | Find similar | Unroll thread


Thread

Not understanding OOP stuff bit-naughty@hotmail.com - 2017-07-21 09:11 -0700
  Re: Not understanding OOP stuff JJ <jj4public@vfemail.net> - 2017-07-22 19:36 +0700
  Re: Not understanding OOP stuff Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2017-07-23 18:12 +0200
    Re: Not understanding OOP stuff Julio Di Egidio <julio@diegidio.name> - 2017-07-23 09:19 -0700
      Re: Not understanding OOP stuff Ben Bacarisse <ben.usenet@bsb.me.uk> - 2017-07-23 20:10 +0100
        Re: Not understanding OOP stuff Julio Di Egidio <julio@diegidio.name> - 2017-07-23 12:42 -0700
          Re: Not understanding OOP stuff Ben Bacarisse <ben.usenet@bsb.me.uk> - 2017-07-23 22:03 +0100
            Re: Not understanding OOP stuff Julio Di Egidio <julio@diegidio.name> - 2017-07-23 14:18 -0700
              Re: Not understanding OOP stuff Ben Bacarisse <ben.usenet@bsb.me.uk> - 2017-07-24 03:22 +0100
                Re: Not understanding OOP stuff Julio Di Egidio <julio@diegidio.name> - 2017-07-23 21:44 -0700
            Re: Not understanding OOP stuff Ben Bacarisse <ben.usenet@bsb.me.uk> - 2017-07-24 03:49 +0100
              Re: Not understanding OOP stuff Julio Di Egidio <julio@diegidio.name> - 2017-07-23 21:50 -0700
                Re: Not understanding OOP stuff John G Harris <niam@jghnorth.org.uk.invalid> - 2017-07-24 19:50 +0100
                Re: Not understanding OOP stuff Julio Di Egidio <julio@diegidio.name> - 2017-07-24 12:00 -0700
                Re: Not understanding OOP stuff John G Harris <niam@jghnorth.org.uk.invalid> - 2017-07-25 09:29 +0100
                Re: Not understanding OOP stuff Julio Di Egidio <julio@diegidio.name> - 2017-07-25 05:58 -0700
              Re: Not understanding OOP stuff Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2017-07-24 11:04 +0200
                Re: Not understanding OOP stuff Ben Bacarisse <ben.usenet@bsb.me.uk> - 2017-07-25 00:09 +0100
                Re: Not understanding OOP stuff John G Harris <niam@jghnorth.org.uk.invalid> - 2017-07-25 09:20 +0100
                Re: Not understanding OOP stuff Ben Bacarisse <ben.usenet@bsb.me.uk> - 2017-07-25 11:31 +0100
                Re: Not understanding OOP stuff Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2017-07-25 17:02 +0200
                Re: Not understanding OOP stuff Ben Bacarisse <ben.usenet@bsb.me.uk> - 2017-07-25 23:47 +0100
                Re: Not understanding OOP stuff Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2017-07-27 15:15 +0200
            Re: Not understanding OOP stuff Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2017-07-24 10:33 +0200
              Re: Not understanding OOP stuff Julio Di Egidio <julio@diegidio.name> - 2017-07-24 02:13 -0700
          Re: Not understanding OOP stuff John G Harris <niam@jghnorth.org.uk.invalid> - 2017-07-24 11:15 +0100
            Re: Not understanding OOP stuff Julio Di Egidio <julio@diegidio.name> - 2017-07-24 03:58 -0700
              Re: Not understanding OOP stuff John G Harris <niam@jghnorth.org.uk.invalid> - 2017-07-25 09:42 +0100
                Re: Not understanding OOP stuff Julio Di Egidio <julio@diegidio.name> - 2017-07-25 05:59 -0700
                Re: Not understanding OOP stuff John G Harris <niam@jghnorth.org.uk.invalid> - 2017-07-25 18:32 +0100
        Re: Not understanding OOP stuff Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2017-07-23 22:42 +0200
          Re: Not understanding OOP stuff Julio Di Egidio <julio@diegidio.name> - 2017-07-23 13:55 -0700
          Re: Not understanding OOP stuff John G Harris <niam@jghnorth.org.uk.invalid> - 2017-07-24 11:18 +0100
            Re: Not understanding OOP stuff Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2017-07-24 15:19 +0200
      Re: Not understanding OOP stuff "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2017-07-24 10:20 -0700
        Re: Not understanding OOP stuff Julio Di Egidio <julio@diegidio.name> - 2017-07-24 11:46 -0700
          Re: Not understanding OOP stuff "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2017-07-25 05:37 -0700
    Re: Not understanding OOP stuff John G Harris <niam@jghnorth.org.uk.invalid> - 2017-07-24 11:04 +0100
      Re: Not understanding OOP stuff Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2017-07-24 16:04 +0200

csiph-web