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


Groups > comp.lang.javascript > #33658

Re: Not understanding OOP stuff

From Ben Bacarisse <ben.usenet@bsb.me.uk>
Newsgroups comp.lang.javascript
Subject Re: Not understanding OOP stuff
Date 2017-07-25 00:09 +0100
Organization A noiseless patient Spider
Message-ID <871sp5ph3z.fsf@bsb.me.uk> (permalink)
References (5 earlier) <3298850e-dce6-4384-af58-8bb58830960f@googlegroups.com> <87379msw5i.fsf@bsb.me.uk> <messages-20170723230918@ram.dialup.fu-berlin.de> <87a83ur1kp.fsf@bsb.me.uk> <3335323.kQq0lBPeGt@PointedEars.de>

Show all headers | View raw


Thomas 'PointedEars' Lahn <PointedEars@web.de> writes:

> Ben Bacarisse wrote:
>
>> ram@zedat.fu-berlin.de (Stefan Ram) writes:
>>> Ben Bacarisse <ben.usenet@bsb.me.uk> writes:
>>>>The interesting things are the concepts not the names.  ECMAScript
>>>>supports many of the concepts that people like Alan Kay would say are
>>>>essential to being object-oriented.  It supports local retention and
>>>>hiding of state along with extreme late binding, but it does not use
>>>>message passing as the communication between objects.¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
>>>  ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
>>>   Why can't I say that when the JavaScript expression
>>>
>>> o.m()
>>>
>>>   is being evaluated, "the call message »m()« is being
>>>   sent to the object »o«"¹?
>> 
>> You certainly can.  I don't like to say that but it's very far from
>> being objectively wrong to do so.
>
> ACK.
>  
>>>   How do you define »message passing«, and which part
>>>   of your definition is not fulfilled by ECMAScript?
>> 
>> For me, a message should be a thing in itself (in Smalltalk messages
>> are, conceptually, objects though almost always optimised away).  You
>> should be able, when required, to build one at run-time and store it for
>> later sending to an object. 
>
> That is possible in ECMAScript implementations:
>
>   var f = function (/* … */) { /* … */ };
>   var o = {};
>   o.foo = f;
>   o.foo();
>
>> A natural consequence of that would be the ability of an object to forward
>> a message to some other object.
>
> That is also possible in ECMAScript implementations:
>
>   var o2 = {};
>   o2.bar = o.foo;
>   o2.bar();
>
>   var o3 = {};
>   o2.foo.call(o3, 42, 23);
>   o2.foo.apply(o3, [42, 23]);

(Did you mean o.foo or o2.bar here?)

That's not really what I mean because because there is no "thing" (I
want to avoid saying object here) that is the message.  By making the
message a think in its own right, message passing systems can disconnect
the message from the method that implements it.  That's all part of the
late binding that some people consider so important.

For example, in a message passing language the message can fail if the
object does not implement that particular message.  In your examples,
the message sending (which is just a function call) can't fail for that
reason.

To my mind, message passing would look rather more like:

  var msg = ["foo", 42, 23];
  o.process_message(msg);

This would succeed or fail depending on whether o's prototype chain
included a foo method at that time.

<snip>
-- 
Ben.

Back to comp.lang.javascript | Previous | Next — Previous in thread | Next 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