News for hackers. Stuff that matters.
Re:C Object Oriented Programming (2014) by meheleventyone on Friday December 22, 2023 @02:39AM (#38731902)
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.
Re:C Object Oriented Programming (2014) by alex_smart on Friday December 22, 2023 @03:59AM (#38732343)
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.
Re:C Object Oriented Programming (2014) by meheleventyone on Friday December 22, 2023 @12:40PM (#38736556)
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.
Re:C Object Oriented Programming (2014) by alex_smart on Friday December 22, 2023 @10:35PM (#38741393)
I don't think ability to forward arbitrary messages is any more a core part of Smalltalk than it is of Java.
Re:C Object Oriented Programming (2014) by meheleventyone on Saturday December 23, 2023 @05:30AM (#38743138)
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.