Especially in the context of Fixnum#times. How does message passing vs method calling matter there? #times is just a method on Fixnum.
Especially in the context of Fixnum#times. How does message passing vs method calling matter there? #times is just a method on Fixnum.
So the difference isn't just with method_missing.
With "method calling" as you put it, the program blows up if that object doesn't have that method, WHEN YOU CALL IT.
Basically, this smalltalk oo paradigm is about shifting where you put more of your logic. At & around the "call" site, or within the object whom you're calling & entrusting to do something useful with it.
All hearkening back to Alan Kay's original ideas about biology influencing how we organise code, and having a program be 1000's of "little black boxes" where work gets done by all these boxes talking to each other.
Which is why smalltalk (& ruby implements the Smalltalk object model to its entirety) actually has an awful lot in common with Erlang & other BEAM runtimes, even though those are functional languages. Because once you get beyond the techy buzzwords, the main ethos behind them is actually quite similar.
ActiveRecord has changed a lot over the years, but as an example in the original ActiveRecord you used dynamic finders. None of the finder methods existed initially, but if you passed a message to an active record object for a non existent method rather than fail it would determine if that should be a method and then it would build and persist a method to the process for future calls.
It allows for some really interesting and powerful applications in horizontally scaling as well.
The difference is fairly subtle most of the time in practice, which is why dynamic OO languages like Ruby that use message passing can mostly look like OO languages that use method calling, though it is significant behind the scenes and opens up a lot of possibilities; one of the more obvious practical differences is that it is why Ruby can capture and handle unknown "method calls" via "method_missing", which works the way it does because the version of __send__ defined in BasicObject looks for an existing method matching its first argument in the object's inheritance chain, and if it finds that calls it, and if it doesn't find one does the same thing with the "method_missing" method.
There's a lot that can be built on top of this, either leveraging method_missing or more directly.
Though I think the more relevant issue upthread isn't message passing vs method calling but narrow vs broad conception of nouns/agents.