From: Mo D. <md...@cy...> - 2000-10-31 20:33:58
|
> I still have a few things (other than the find->info change) > that I would like the TCT to consider. Nothing wrong with that. > Here is my suggestion: > > 1. Get rid of common and replace it with 'static variable'. I had this thought some time ago. The answer I heard back was "NOOOO! Not the keyword static". The point was that static was an abused keyword in C and C++ and we should not continue the abuse. I thought it was silly at first, but it kind of makes sense. Along the same lines, I proposed using common to denote the class wide nature of something. It is already used for variables, but in a somewhat confusing way because there is no mention of variables in a "common foo" declaration. like: itcl::class Foo { variable Fun -1 common variable Num 10 } Make no mistake about it, this is an area that is confusing to newbies. I asked a number of folks and they answered, "what does that common keyword do again?". > 2. No longer allow proc inside of the class. Instead, have > 'method' and 'static method'. By that same logic, you could declare: itcl::class Foo { common method Bar {} { } } On the other hand, why should Itcl even provide a "static method" or "static variable" type of construct? itcl::class Foo { common Nog 5 } % set Foo::Nog 5 How is that any different than: namespace eval Foo { set Nog 5 } Same for "static procs" in a namespace, why not just remove (disallow) the feature all together? Do we really need it anymore, I am sure it was needed in the original Itcl design, but is it really still needed? Kind of like the "Class :: foo" way of invoking a class method in the old days. It has now been replaced by namespaces, which use Class::foo, so the custom resolver is no longer needed. > 3. Get rid of 'body'. When using proc in the form: > > proc className::methodName {} { > } ... > With my proposed changes you would no longer have > the commands 'common' or 'proc' inside of a class > body or the global command 'body'. They would be > replaced by the command static (variable|method) > inside of the class and by a smarter 'proc' at the > global level. I don't like the static keyword, but I don't think the "smarter proc" is a bad idea. It seems like things could be simplified, and that could make "Tcl OO" easier to learn. > None of these changes that I am proposing are radical > (or at least they aren't radical in my opinion) but > I think that they do improve the proposed tcl OO system > and I hope that some/most of you will agree with me. Well, I don't see them as "too radical", but I like change so that that with a grain of salt :) I am not too swayed by the cries of "think of the legacy code", perhaps because I work on code of that sort all the time. Mo DeJong Red Hat Inc -- The TclCore mailing list is sponsored by Ajuba Solutions To unsubscribe: email tcl...@aj... with the word UNSUBSCRIBE as the subject. |