Re:Alan Kay on the Meaning of “Object-Oriented Programming” ...
by inopinatus on Sunday March 17, 2019 @09:06PM
(#19417907)
I think you mean Object#send? I actually think that's misnamed, I think it should be named Object#receive because that's what happens - you're forcing an object to receive a symbol for (by default) dispatch through its method table.
The fact it isn't invoked for regular method invocation is kinda indicative of Ruby _not_ being a pure message passing language, even if we like treating it that way.
Re:Alan Kay on the Meaning of “Object-Oriented Programming” ...
by chrisseaton on Sunday March 17, 2019 @09:24PM
(#19417996)
> I think you mean Object#send?
It's definitely Kernel#send. Object defines no instance methods at all.
> Kernel.instance_methods(false).include?(:send)
=> true
> Object.instance_methods(false).include?(:send)
=> false
> Object.instance_methods(false)
=> []
https://github.com/ruby/ruby/blob/v2_6_2/vm_eval.c#L2163
Re:Alan Kay on the Meaning of “Object-Oriented Programming” ...
by inopinatus on Sunday March 17, 2019 @09:33PM
(#19418042)
Fascinating, the docs are misleading on this point. http://ruby-doc.org/core-2.6.2/Object.html#method-i-send because Object includes Kernel and it's just easier to find, I guess.
That's a somewhat arcane implementation detail though. What about the meat of the discussion?
Re:Alan Kay on the Meaning of “Object-Oriented Programming” ...
by chrisseaton on Sunday March 17, 2019 @09:36PM
(#19418057)
I don't think Ruby is message passing either because the caller determines which method to call, based on the object's method table. #method_missing is just another method to be called by the caller - it isn't an example of the object being able to determine what happens. I think #send is really #call, but I think the name implies someone somewhere thought it was message passing.
If I'm being uncharitable I think applying the term 'message passing' to Ruby is a bit of making something sound more sophisticated and elaborate than it is. They're method calls - it's pretty simple already and doesn't need a complex concept on top of that.
Re:Alan Kay on the Meaning of “Object-Oriented Programming” ...
by inopinatus on Sunday March 17, 2019 @09:51PM
(#19418119)
It merely remains to fork and/or invent a language that otherwise looks almost exactly like Ruby but with message passing only.
Re:Alan Kay on the Meaning of “Object-Oriented Programming” ...
by macintux on Sunday March 17, 2019 @09:53PM
(#19418132)
Elixir?
Re:Alan Kay on the Meaning of “Object-Oriented Programming” ...
by chrisseaton on Sunday March 17, 2019 @10:06PM
(#19418187)
Elixir has conventional method calls by default, and only optional message passing with a separate syntax. It's definitely not message passing everywhere.
Re:Alan Kay on the Meaning of “Object-Oriented Programming” ...
by macintux on Monday March 18, 2019 @09:48AM
(#19420947)
It’s message passing everywhere outside the current object (process).
It’s a little tough to compare to an OO language because there are no classes, but all object to object communications are asynchronous messages.
There is of course the `Kernel#send` method, which implies the model is messages being sent. It's not called `call`.