Deutsch English Français Italiano |
<877c4nb4wt.fsf@example.com> View for Bookmarking (what is this?) Look up another Usenet article |
Path: news.eternal-september.org!eternal-september.org!.POSTED!not-for-mail From: Salvador Mirzo <smirzo@example.com> Newsgroups: comp.misc Subject: Re: Alan Kay on OOP Date: Mon, 17 Mar 2025 20:42:26 -0300 Organization: A noiseless patient Spider Lines: 99 Message-ID: <877c4nb4wt.fsf@example.com> References: <878qprd0v3.fsf@ic.ufrj.br> <object-oriented-20250227141811@ram.dialup.fu-berlin.de> MIME-Version: 1.0 Content-Type: text/plain Injection-Date: Tue, 18 Mar 2025 00:42:27 +0100 (CET) Injection-Info: dont-email.me; posting-host="dc85f6e6c44f8200f17181be07cc8eca"; logging-data="1256286"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19bDN8xiUmp/dENb5gs42S0i220KgHnHfE=" Cancel-Lock: sha1:6/TN/LW0W2aCbw/xLOQgakjiC7s= sha1:NZIAIjAmSTB5ScJqVhuNEiMmnHE= ram@zedat.fu-berlin.de (Stefan Ram) writes: > Salvador Mirzo <smirzo@example.com> wrote or quoted: >>I've read the Early History of Smalltalk, by the way. I think I >>understand what he means by ``messaging'', ``local retention and >>protection'' and ``hiding of state-process''. My knowledge reaches its >>limits a bit in ``extreme late-binding of all things'' and I get >>certainly puzzled in ``it can be done in Smalltalk and in LISP'' given >>that he is ``not aware of [others]''. > > Object-oriented programs contain expressions to describe the sending > of messages at runtime. Here's an example of such an expression: > > o s: x > > . "o" is the receiver object, "s" the selector (keyword) of the > message, and x is an argument. > > "Extreme late-binding of all things" to me (S. R.) means > that it is possible to give the the values of "o" and "x" > (including their types) only as late as immediately before > "o s: x" is being evaluated (executed). Thanks. That makes sense! >>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? > > He might have some criteria he has not mentioned. Okay. I thought there was something obvious to some that I didn't know. > For example, in Smalltalk, blocks of code are objects, too, > and you can define your own custom bool type and "if" statement > using Smalltalk and such blocks. Maybe he requires that, in > an object-oriented language, blocks of code are objects, too. [1] Interesting. What is the class of these objects that are blocks of code? (Thanks for the awesome example in [1].) > In LISP, you can have code values using "LAMBDA", and maybe > that's the criterion Alan Kay used, as both Smalltalk and LISP > have code block as run-time values. > > In Python and in Java there also are non-object-oriented features, > and maybe he requires that, in an object-oriented programming > language, everything has to be done in an object-oriented way; > what might be called a "/pure(ly)/ object-oriented language". Yeah---that makes sense to me. Maybe he requires that really everything must be an object, including code blocks. So I guess Smalltalk and LISP are the purely object-oriented languages---or at least the first ones. > [1] > > So, you define two classes "True" with > > ifTrue: aBlock > ^aBlock value > > and "False" with > > ifTrue: aBlock > ^nil > > . Now we have implemented an if statement using polymorphism > that can be used as: > > a > 0 ifTrue: [a := 0] > > . I have not checked this code on a Smalltalk implementation. > Maybe it needs some additions or modifications, but it gives > the general idea. > > An attempt to emulate this in Python: > > main.py > > class True_: > def if_true( self, block ): > exec( block ) > > class False_: > def if_true( self, block ): > pass > > class Boolean_: > def __new__( self, value ): > return True_() if value else False_() > > a = -2; Boolean_( a < 0 ).if_true( "print( 'It is true!' )" ) > a = +2; Boolean_( a < 0 ).if_true( "print( 'It is true!' )" ) > > output > > It is true! Very cool! Thanks for the example!