No registered users in community xowiki
in last 10 minutes
in last 10 minutes
Re: [Xotcl] Bug or feature in 1.1.2. Access to subobjects
From: Artur Trzewik <mail_at_xdobry.de>
Date: Wed, 31 Dec 2003 11:24:02 +0100
Hallo!
The new convention of calling subobject is indeed interesting.
I have looked in my code and discovered a lot of
[self]::subobject method ...
To write it as
my subobject method
must be more performant because [self]::subobject will be every time
substituted and can be not handled as internal Tcl object.
Yet XOTclIDE is not compatible with this convention because I use Class
subobjects as descriptors for methods with the same name as method.
This subobjects are used to handle version control informations.
And in the one case a get subobject instead of method call.
> c) use different nameing conventions for sub-objects, e.g.
> C o; C o::_at_a
>
This is for me the best solution. In the best case I need to change only one
method.
The another Aspect in this new feature is the code analyse (syntax checker).
In the old code by call
my method
"method" can be only method. Now it can be also subobject that can
be defined dynamically.
Static syntax analyse is so not very reliable.
But also a human who need to read a code must consider the two cases.
Convention or another syntax can be good in this case.
[self]::b method
my b method; # what is object, what is method name, what is argument
[my subobject b] method; # alternative but not good for subcommands
my . b method; # . were special syntax for it
or build all subobjects with special prefix
my _at_b method
There are many pro and contra. It is not clear for me now.
Happy new year
Artur Trzewik
Date: Wed, 31 Dec 2003 11:24:02 +0100
Hallo!
The new convention of calling subobject is indeed interesting.
I have looked in my code and discovered a lot of
[self]::subobject method ...
To write it as
my subobject method
must be more performant because [self]::subobject will be every time
substituted and can be not handled as internal Tcl object.
Yet XOTclIDE is not compatible with this convention because I use Class
subobjects as descriptors for methods with the same name as method.
This subobjects are used to handle version control informations.
And in the one case a get subobject instead of method call.
> c) use different nameing conventions for sub-objects, e.g.
> C o; C o::_at_a
>
This is for me the best solution. In the best case I need to change only one
method.
The another Aspect in this new feature is the code analyse (syntax checker).
In the old code by call
my method
"method" can be only method. Now it can be also subobject that can
be defined dynamically.
Static syntax analyse is so not very reliable.
But also a human who need to read a code must consider the two cases.
Convention or another syntax can be good in this case.
[self]::b method
my b method; # what is object, what is method name, what is argument
[my subobject b] method; # alternative but not good for subcommands
my . b method; # . were special syntax for it
or build all subobjects with special prefix
my _at_b method
There are many pro and contra. It is not clear for me now.
Happy new year
Artur Trzewik