No registered users in community xowiki
in last 10 minutes
in last 10 minutes
[Xotcl] Method inheritance on class side
From: Artur Trzewik <mail_at_xdobry.de>
Date: Sun, 22 Apr 2001 14:02:55 +0200
Hallo
By building some Xotcl Class System I have following problem.
Consider the example
% Class A
A
% A proc test {} { puts "method test" }
% Class B -superclass A
B
% B test
test
%
I would expect by calling B test to invoke A proc test and not to create new
instance of B.
I know this bahavior from Smalltalk. It is very usefull for building special
creating method on class side or some method that not need a instance
For Example (getter for a system constant)
Class A
A proc getSystemPath {} { return \usr }
Class B -superclass A
B proc getConfigFile {} {
return [file join [[self] getSystemPath] System.cfg]
}
This would create new Instance of B with name getSystemPath
Now I have to write:
B proc getConfigFile {} {
return [file join [A getSystemPath] System.cfg]
}
or implement proc search on class side by myself
This was rather simple example but there are many examples in smalltalk
libraries for reasonable use of this bahavior.
Is there a chance to change it in next version?
It would make my system easier and cleaner
mfG
=========================================
Artur Trzewik
http://www.xdobry.de
=========================================
Date: Sun, 22 Apr 2001 14:02:55 +0200
Hallo
By building some Xotcl Class System I have following problem.
Consider the example
% Class A
A
% A proc test {} { puts "method test" }
% Class B -superclass A
B
% B test
test
%
I would expect by calling B test to invoke A proc test and not to create new
instance of B.
I know this bahavior from Smalltalk. It is very usefull for building special
creating method on class side or some method that not need a instance
For Example (getter for a system constant)
Class A
A proc getSystemPath {} { return \usr }
Class B -superclass A
B proc getConfigFile {} {
return [file join [[self] getSystemPath] System.cfg]
}
This would create new Instance of B with name getSystemPath
Now I have to write:
B proc getConfigFile {} {
return [file join [A getSystemPath] System.cfg]
}
or implement proc search on class side by myself
This was rather simple example but there are many examples in smalltalk
libraries for reasonable use of this bahavior.
Is there a chance to change it in next version?
It would make my system easier and cleaner
mfG
=========================================
Artur Trzewik
http://www.xdobry.de
=========================================