From: Gustaf N. <ne...@wu...> - 2005-09-29 08:55:31
|
Jeff Hobbs schrieb: > Will Duquette wrote: > >> I'm all for aesthetics. But I disagree that msot objects >> are created "nameless". In Tk, every widget has an explicit name. >> And in my applications there are often quite a few singleton >> objects defined with well-known names. >> > I would not make the argument against nameless objects based > on Tk. I have programmed Tk using several other languages > (Ruby, Perl and Python), and have found that with reasonable > parent relationships, there is very little need to name > widgets specifically. You have it in Tk due to Tcl's lack > of OO and Tcl/Tk's requirement by design. I have missed the begin of this discussion, i hope i am not off-topic.... Bare in mind, that classes are objects as well. One might want to configure classes and objects (like in the tk options database or .Xdefaults). Furthermore, unnamed objects/classes makes it more cumbersome to define programs if one cannot refer to e.g. ::xotcl::Object, one needs probably a bunch of same-named variables (e.g. $::xotcl::Object), same is true for refering to classes e.g. in superclass, mixins, etc. debug programs puts "[self]->[self class] something wierd...." will be meaningless furthermore it will be hard from the message to locate the right method or to define graphical browsers for the object system As Tcl/xotcl/oo::tcl are **command**-based, it would be pretty much the same as supporting only unnamed procs, like in set p [proc arg1 arg2 arg3] .... [$p a b c] so, from my experience, it makes send to have both, named and unnamed objects (that s why xotcl has both "create", and "new"). -gustaf |