Re: Alan Kay on OOP

Liste des GroupesRevenir à c misc 
Sujet : Re: Alan Kay on OOP
De : ldo (at) *nospam* nz.invalid (Lawrence D'Oliveiro)
Groupes : comp.misc
Date : 28. Feb 2025, 00:43:14
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <vpqtah$3aker$3@dont-email.me>
References : 1
User-Agent : Pan/0.162 (Pokrosvk)
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.

Date Sujet#  Auteur
27 Feb 25 * Alan Kay on OOP7Salvador Mirzo
27 Feb 25 +* Re: Alan Kay on OOP5Stefan Ram
27 Feb 25 i+- Re: Alan Kay on OOP1Stefan Ram
27 Feb 25 i+- Re: Alan Kay on OOP1Lawrence D'Oliveiro
18 Mar 25 i`* Re: Alan Kay on OOP2Salvador Mirzo
18 Mar 25 i `- Re: Alan Kay on OOP1Stefan Ram
28 Feb 25 `- Re: Alan Kay on OOP1Lawrence D'Oliveiro

Haut de la page

Les messages affichés proviennent d'usenet.

NewsPortal