Hacker News new | past | comments | ask | show | jobs | submit login

> Even OO languages can be message passing.

IIRC, Kay said message passing was the essential feature of his conception of OOP in the first place, which was subsequently ignored by most—so 'even OO languages' may be slightly misleading ;)

(Someone please correct me if I'm mistaken about this.)




You are not wrong. Although Kay described what he thought of as the essential feature(s) of OO in slightly different ways, "messaging" was usually in there.

> Smalltalk is not only NOT its syntax or the class library, it is not even about classes. I'm sorry that I long ago coined the term "objects" for this topic because it gets many people to focus on the lesser idea.

> The big idea is "messaging"

--http://lists.squeakfoundation.org/pipermail/squeak-dev/1998-...

> I thought of objects being like biological cells and/or individual computers on a network, only able to communicate with messages...

> OOP to me means only messaging, local retention and protection and hiding of state-process, and extreme late-binding of all things.

--http://userpage.fu-berlin.de/~ram/pub/pub_jf47ht81Ht/doc_kay...

(I wasn't sure what he meant by "extreme late-binding", but Wikipedia says:

> Late binding, dynamic binding[1], or dynamic linkage[2] is a computer programming mechanism in which the method being called upon an object or the function being called with arguments is looked up by name at runtime.

--https://en.wikipedia.org/wiki/Late_binding

That makes sense to me as part of transforming 'method calling' into 'message passing' -- the 'method name' you are sending isn't actually fixed to a particular implementation that will receive it, until it is sent. Rubyists may be familiar with this, as ruby indeed implements methods as 'message passing', just like this.)


You'll probably love to read this interview

https://www.infoq.com/interviews/johnson-armstrong-oop

I quote from the first answer of Armstrong (Erlang)

> The 3 things that object oriented programming has it's messaging, which is possibly the most important thing. The next thing is isolation and that's what I talked about earlier, that my program shouldn't crash your program, if the 2 things are isolated, then any mistakes I make in my program will not crash your program. [...]

> The third thing you want is polymorphism. Polymorphism is especially regarding messaging, that's just there for the programmer's convenience. It's very nice to have for all objects or all processes or whatever you call them, to have a printMe method - "Go print yourself" and then they print themselves. [...]

> Erlang has got all these things. It's got isolation, it's got polymorphism and it's got pure messaging. From that point of view, we might say it's the only object oriented language [...]

By not crashing the other program he means two programs running inside the same VM. There can be many programs running inside the same BEAM (Erlang's VM) and they can be kept isolated via different supervisors. It's the normal state of that system. Example: what in other languages is a library to make HTTP calls in Erlang (or Elixir) is a separate process that receives messages with the arguments of the calls.


"extreme late-binding"

Perl allows you to do:

$object->$method($arg);

And a special can() method to see if $method exists...returns a usable code reference.

There's even a pretty nutty wildcard way of handling methods/functions that don't exist, as if they do (AUTOLOAD): https://perldoc.perl.org/perlsub.html#Autoloading

Though I've never run into a plausible reason to do any of that.




Guidelines | FAQ | Support | API | Security | Lists | Bookmarklet | Legal | Apply to YC | Contact

Search: