Re:Alan Kay on the Meaning of “Object-Oriented Programming” ...
by Gibbon1 on Sunday March 17, 2019 @07:16PM
(#19417406)
> and it should be possible to send a message that is not understood without causing a fatal error
I do that sort thing in C via a SendMessage(msgType...) idiom. Instead of a bunch of functions, you have one function and a message Type and some data. If the destination doesn't know what to do with a message of type whatever it just spits that back.
Re:Alan Kay on the Meaning of “Object-Oriented Programming” ...
by 0815test on Sunday March 17, 2019 @08:13PM
(#19417688)
This is basically how defunctionalization is implemented. I'm less confident about the "what if the destination doesn't know about the msgType you sent" issue, because defunctionalization itself is a whole-program technique where the destination context has to know what to do with your function call. But your solution (i.e. raising an error condition) looks reasonable enough.
In any event the caller must not be specifying the function to call (i.e. it's a virtual method in C++ terms) and it should be possible to send a message that is not understood without causing a fatal error (requires reflection in many languages).