Path: ...!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!eternal-september.org!.POSTED!not-for-mail From: Lawrence D'Oliveiro Newsgroups: comp.misc Subject: Re: Alan Kay on OOP Date: Thu, 27 Feb 2025 23:43:14 -0000 (UTC) Organization: A noiseless patient Spider Lines: 49 Message-ID: References: <878qprd0v3.fsf@ic.ufrj.br> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Injection-Date: Fri, 28 Feb 2025 00:43:14 +0100 (CET) Injection-Info: dont-email.me; posting-host="15a5a1eba7c56e832699653689652217"; logging-data="3494363"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+qhmu9bOiVulRZsfP+BZ5B" User-Agent: Pan/0.162 (Pokrosvk) Cancel-Lock: sha1:6EHsCnKKPKDkDSwCKFSKvLK57eU= Bytes: 2827 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.