Forums before death by AOL, social media and spammers... "We can't have nice things"
|    comp.misc    |    General topics about computers not cover    |    21,759 messages    |
[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]
|    Message 20,795 of 21,759    |
|    Lawrence D'Oliveiro to Salvador Mirzo    |
|    Re: Alan Kay on OOP    |
|    27 Feb 25 23:43:14    |
      From: ldo@nz.invalid              On Thu, 27 Feb 2025 09:32:32 -0300, Salvador Mirzo wrote:              > I think he mentions late-binding because I suppose that is required for       > OOP in static languages like C++, say.              Consider a simple inheritance relationship like (Python example):               class ErrorReturn(Exception) :        ...               def to_message(self, validate = None) :        ...        #end to_message               #end ErrorReturn               class InterfaceErrorReturn(ErrorReturn) :        ...               def to_message(self) :        return super().to_message(self.validate)        #end to_message               #end InterfaceErrorReturn              If you call to_message() on an instance of InterfaceErrorReturn, you will       be invoking the method defined in that class, not in the ErrorReturn       superclass. This happens even in a context where the code might be       expecting an instance of ErrorReturn. That’s “late binding”, where the       method dispatch depends on the dynamic type of the object, not on some       expected type that might be deduced by the compiler from the context.              In C++, you have to get this behaviour by prefixing your method       definitions with the “virtual” keyword. You even have to do this for the       destructor (if any), even though non-“virtual” destructors don’t make       sense.              In more pure OO languages, all methods are effectively “virtual”, so no       special keyword is needed to indicate this.              > Now, to address my main puzzle. The email is from 2003. Alan Kay was       > certainly aware of Python, Java and so on. Why would his notion of OOP       > be impossible in Python or Java?              I’m sure he was aware of Java, but possibly not Python. Probably he was       aware of Dylan. He might even have considered Python beneath his notice:       at that time it was still in version 2.3 or so, and was still carrying       around the baggage of two different ways of defining classes: the old way       and the right way.              --- SoupGate-DOS v1.05        * Origin: you cannot sedate... all the things you hate (1:229/2)    |
[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]
(c) 1994, bbs@darkrealms.ca