>> My criteria for object oriented was that (1) different objects react
>> to the same message in the same way. Clearly different Tk widgets do
>> this. And (2), Different classes can share common code.
>>
>
>i assume you mean different objects of the same class respond to the same
>message the same way (by executing the same method). if you mean that
>objects of different calsses respond the same way to the same message,
>you need to look up polymorphism in the context of OOP.
I mean that different classes respond to the same message in a
different albeit appropriate fashion.
>> Admittedly Tk does poorly here, but it does have re-use, mostly
>> because common stuff is split off into utility functions. No, Tk
>> doesn't support _further_ inheritance without re-organising the code,
>> but the re-use is there through splitting off common stuff.
>>
>
>that isn't inheritance, it's reuse.
Implementation inheritance is just a formalised discipline for code
re-use. Take a look at a language which separates the concepts of
interface and implementation inheritance.
>> So Tk is a good example of how not to do OO. How much cleaner it would
>> be if it did OO properly.
>>
>> Now look at Stk. They have put a layer on top making Tk appear to
>> fully support inheritance, and you can inherit and make
>> specialisations of widgets and everything. Infinitely more powerful
>> than Tcl/Tk can ever be.
>
>or you could just start with a language that does it right from the start.
Stk Scheme is a language which _has_ "done it right" from the start.
|