Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
| From | Salvador Mirzo <smirzo@example.com> |
|---|---|
| Newsgroups | comp.misc |
| Subject | Re: Alan Kay on OOP |
| Date | 2025-03-17 20:42 -0300 |
| Organization | A noiseless patient Spider |
| Message-ID | <877c4nb4wt.fsf@example.com> (permalink) |
| References | <878qprd0v3.fsf@ic.ufrj.br> <object-oriented-20250227141811@ram.dialup.fu-berlin.de> |
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!
Back to comp.misc | Previous | Next — Previous in thread | Find similar
Alan Kay on OOP Salvador Mirzo <smirzo@example.com> - 2025-02-27 09:32 -0300 Re: Alan Kay on OOP Lawrence D'Oliveiro <ldo@nz.invalid> - 2025-02-27 21:24 +0000 Re: Alan Kay on OOP Lawrence D'Oliveiro <ldo@nz.invalid> - 2025-02-27 23:43 +0000 Re: Alan Kay on OOP Salvador Mirzo <smirzo@example.com> - 2025-03-17 20:42 -0300
csiph-web