Hacker News new | ask | show | jobs
by meheleventyone 905 days ago
Yeah, the callee doesn’t have to have the method defined for it to be called and Smalltalk objects have a default you can use to do things with messages you don’t handle for example forward them on to another object.
1 comments

You can definitely do that in Java too. This is how, e.g., Spring framework handles transactional behavior. It injects a proxy for each bean that is marked as @Transactional and the proxy object handles the coordination with the transaction manager and passes all the arguments to the real object.
Right but it’s not a core part of the language, anything Turing complete can implement this sort of thing. The comment I was replying to was asking about the difference between method calls and message passing.
I don't think ability to forward arbitrary messages is any more a core part of Smalltalk than it is of Java.
It’s the basis of the design of Smalltalk (see http://lists.squeakfoundation.org/pipermail/squeak-dev/1998-...) and needs scaffolding in Java to work which does seem significant.