A late-night rant about OOP and parametric dispatch

Update: this post was the product of an exhausted mind, and as such it misused terms, wasn’t well backed-up, and was generally incoherent. I’m withdrawing it until such time as I can articulate these ideas a little more competently.

I’m leaving this note here just to explain the absence. Here, have a photo of a mountain view:

image

6 comments

  1. Alan Kay I made up the term “object-oriented”, and I can tell you I did not have C++ in mind.

    James’ paradigm of objects seems compromised by learning it via a sugar coated procedural language. When “objects” became a bigthing*, all languages got busy jamming that square peg into their existing round hole. Indeed Alan Kay says “I made up the term ‘object-oriented’, and I can tell you I did not have C++ in mind.”

    We see here the Blub Paradox at work (http://www.paulgraham.com/avg.html). I consider Smalltalk the blub of OOP. Maybe it has its failings, but I feel I never properly understood how to “think” about objects until I tried Smalltalk. These days I’m enjoying Pharo’s reinvigoration of Smalltalk.

    You might like these programming language ancestry charts…
    http://tinyurl.com/programLanguageAncestry
    http://cdn.oreillystatic.com/news/graphics/prog_lang_poster.pdf
    https://www.levenez.com/lang/

  2. I’m not sure I agree about OOP + parametric polymorphism together necessarily being an oxymoron, at least if it’s the receiver’s polymorphism you’re on about (as opposed to the message’s).

    You could exclude this/self/whatever from the “committee meeting”, treat it as definitely what object to send the message to, and use the [other] args to decide what message to send. (That’s how I for one interpret the “name mangling” of C++, though I have no idea whether that’s how it really works under the proverbial hood.) Or, have the receiver interpret the message as one of various possibilities based on what types it gets, a more explicit version of what happens in many hairy methods that can take variable arguments.

    Am I missing something about those being somehow impossible, or misinterpreting some terms? I haven’t studied hifalutin’ OOP theory in depth, especially as it was barely even mentioned to us mere peon undergrads when I was in school….

  3. Parametric polymorphism doesn’t mean what you think it means. It’s not “dispatching on all the arguments to a function”. That would be a multimethod instead.

  4. Parametric polymorphism doesn’t mean dispatching on all arguments to a function. It means type parameters, i.e. generics.

  5. To spell out the tautology more explicitly: I had discovered that in languages which put a light dusting of sugar on the first argument to a function, if you dig through the powdered sugar, you find the first argument to the function.

    Sure – if you’re working in a procedural language.

    But if you’re working in an OO language, then the leftmost thing is not just the first argument to the function, it is the context of the method call.

    [myLanguage blow: mind]

    may be the same thing functionally as

    blow(myLanguage, mind)

    but that’s like saying that OOP doesn’t add anything to Procedural programming. OK – you can do all the same stuff – it’s all just 1’s and 0’s. But OO is all about context and state. With state running a distant second, I think.

    It’s all just sugar on 1’s and 0’s. But the sweetness of an Apple is different than that of an Orange. I prefer my objects on the left, thanks.

Comments are closed.