How do I rename a Class instproc? For example:
Class T -parameter { {msg "Hello world!"} } T instproc hi {} { puts [my msg] } T instparametercmd msg
T t t hi
t msg "Good Bye!" t rename hi bye t bye
Also, what's the difference between using "instparametercmd" and "parametercmd" in the example above?
Thanks,
Kevin
On 16.08.10 15:36, Kevin Van Workum wrote:
How do I rename a Class instproc? For example:
Class T -parameter { {msg "Hello world!"} } T instproc hi {} { puts [my msg] } T instparametercmd msg
T t t hi
t msg "Good Bye!" t rename hi bye t bye
there is no "rename" method predefined in xotcl. i would recommend to implement rename in terms of introspection (see below). with that, your example works.
Also, what's the difference between using "instparametercmd" and "parametercmd" in the example above?
The difference between "instparametercmd" and "parametercmd" is the same as the difference between "instproc" and "proc". The versions starting with "inst" are defined on the class level and represent methods for instances of the class. Without "inst", they are methods on objects (object specific methods).
In your example, you do not need "instparametercmd" (which defines a c-implemented setter method), since the implementation of the method "parameter" defines it already.
-gustaf neumann ============================================
Object instproc method-serialize {o m prefix name} { set arglist [list] foreach v [$o info ${prefix}args $m] { if {[$o info ${prefix}default $m $v x]} { lappend arglist [list $v $x] } {lappend arglist $v} } lappend r $o ${prefix}proc $name \ [concat [$o info ${prefix}nonposargs $m] $arglist] \ [$o info ${prefix}body $m] foreach p {pre post} { if {[$o info ${prefix}$p $m] ne ""} { lappend r [$o info ${prefix}$p $m] } } return $r } Object instproc rename {from to} { foreach {obj methtype name} [my procsearch $from] break switch $methtype { instproc {set newMethod [my method-serialize $obj $from inst $to]} proc {set newMethod [my method-serialize $obj $from "" $to]} default {error "can't rename [my procsearch $from]"} } $obj $methtype $from "" "" eval $newMethod }
Hello Gustaf,
Any hints about a stable release of XOTcl 2.0/Next 1.0? Date? Inclusion with ActiveTcl?
Thanks
Dear Gustaf,
Do you have any instruction on how to pull the latest XOTcl 2.0 code using git. Recently, git started to fail. After I deleted everything and started from scratch, git is pulling XOTcl 1.6 instead of XOTcl 2.0 I am using the following command:
git clone git://alice.wu-wien.ac.at/xotcl 2.0.0-develop
Thank you
Am 28.08.10 05:11, schrieb Victor Mayevski:
Dear Gustaf,
Do you have any instruction on how to pull the latest XOTcl 2.0 code using git. Recently, git started to fail. After I deleted everything and started from scratch, git is pulling XOTcl 1.6 instead of XOTcl 2.0 I am using the following command:
git clone git://alice.wu-wien.ac.at/xotcl 2.0.0-develop
by using the command above, you will obtain a checkout of the head branch of xotcl, which is 1.6 (but you placed it into a directory named 2.0.0-develop).
In order to build the 2.0 version, you have to use the 2.0 branch. In detail, use:
git clone git://alice.wu-wien.ac.at/xotcl 2.0.0-develop cd 2.0.0-develop git branch 2.0.0-develop origin/2.0.0-develop git checkout 2.0.0-develop
best regrads -gustaf neumann