4 ms·
I would say the same thing (or more exactly, the dual) from a Smalltalk perspective: I just want to send a message to an object, I shouldn't have to figure out
by d-mason 4y ago
I would say the same thing (or more exactly, the dual) from a Smalltalk perspective: I just want to send a message to an object, I shouldn't have to figure out what function to call or what to parenthesize. The problem people get into with OO (particularly Java, C#, C++) is thinking in terms of method-function calls rather than message sends.
Although I do like Lisp generics - I did a bunch of programming in rscheme many years ago, and really liked it.
- ncmncm 4y agoMessage passing within a process and function calls are exactly, precisely isomorphic, so complaining about one or the other is just parochialism.
- pjmlp 4y agoSmalltalk and Common Lisp are on my favourite languages list. Yet I never got the point of arguing about implementation details regarding virtual method dispatch versus message passing. Specially when many OOP GUI frameworks combine both approaches.
- ncmncm 4y agoIt's not even an implementation detail. Both use, ultimately, JSR and RET instructions. It really comes down to fetishism, which is why I don't use either of them. I am not a Fetish-Oriented Programming enthusiast. It is also why I am not all in on Rust. Memory safety is pretty important, but it is far from the only important thing in programming. The amount of attention Rust insists I devote to it is attention I don't have available for the other things that, frankly, deserve it more. Considering that in the last 10 years I have spent strictly less time debugging memory usage errors than preparing compiler bug reports against Gcc, putting memory correctness guarantees front and center ahead of all else seems to me a mis-allocation of my extremely scarce attention. Attention is by far the scarcest resource available to any programmer. Allocating and applying attention where it is most needed is the central problem of programming. A language that overrules your judgment as to where your attention must be thus interferes with the core business of programming. C++ does demand just a little more attention to memory management than some other languages, but less all the time. It pays that back by eliminating most taxes on performance, a swap I agree to.
- lisper 4y ago> I just want to send a message to an object Why? Seriously, why is that something you want? Why do you want sending a message to be syntactically and semantically distinct from calling a function? > The problem people get into with OO (particularly Java, C#, C++) is thinking in terms of method-function calls rather than message sends. Well, IMHO the problem people get into with OO is thinking that there is something special about sending a message that is different from calling a function. Sending a message is an implementation technique, not a semantically distinct action that should be exposed in the language semantics, and certainly not in the syntax.
- abecedarius 4y agoWhere it matters 'who' gets what powers or responsibilities, sending messages is a powerful way to think about it, not an implementation detail. In Java it is pretty much just a function call, because the code in the callee has the ability to wreak all kinds of havoc in real Java programs, so the pattern of "messages" is quite imperfectly related to the authorities you're bounding. More at http://habitatchronicles.com/2017/05/what-are-capabilities/ http://habitatchronicles.com/2017/05/what-are-capabilities/
- pjmlp 4y agoIt would be if virtual method tables weren't a thing, and Java didn't do dynamic dispatch by default. Then there are Proxy objects, reflection, and invokedynamic as well, for those "doesNotUnderstand:" scenarios.
- xkriva11 4y agoIn most cases, it is really only an implementation technique, but it may be different. In my eyes, sending a message to a probe on Mars is very different from evaluating a function with the probe as an argument. It's sure that, in this case, a Lisp program would transform the function call to a kind of message send anyway with the expectation that the probe is a standalone computation system. OOP approach makes this assumption implicit for everything.
- 4y ago