> > Um, Tk has no inheritance mechanism.
>
> Tk has no properly designed inheritance mechanism. But it does all the
> same things, albeit in a horrible disorganised way.
>
hence, it has no inheritance mechanism.
> 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.
> 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.
> 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.
b3n
|