No registered users in community xowiki
in last 10 minutes
in last 10 minutes
Re: [Xotcl] Is this a bug?
From: Gustaf Neumann <neumann_at_wu-wien.ac.at>
Date: Thu, 08 Dec 2005 12:43:22 +0100
Hmm, are you sure? the script you have sent does not produce the message
you are indicating....
~/scripts> set ::xotcl::version
1.3
~/scripts> set ::xotcl::patchlevel
.8
~/scripts> Class X -parameter {
> {y y0}
>}
::X
~/scripts> X instproc init {args} { puts "[self] init '$args'"; next }
~/scripts> X instproc y {args} {
> set x [next]
> puts "[self] y '$args'"
> set x
>}
~/scripts> X create x -y y1
::x y 'y0'
::x y 'y1'
::x init ''
::x
=============================
however, most probably it is not doing what you might be expecting.
your method y overwrites the setter method of parameter y, therefore in
this example, not much happens in the next of method y.
maybe you had in mind to overload the setter/getter method, which you can
do e.g. with a mixin (see below)
Class X -parameter {
{y y0}
} -instmixin [Class new -instproc y args {
puts "[self] [self proc] $args"
set x [next]
puts "[self] [self proc] $args setter returns <$x>"
return $x
}]
X create x -y y1
puts x.y=[x set y]
Date: Thu, 08 Dec 2005 12:43:22 +0100
Hmm, are you sure? the script you have sent does not produce the message
you are indicating....
~/scripts> set ::xotcl::version
1.3
~/scripts> set ::xotcl::patchlevel
.8
~/scripts> Class X -parameter {
> {y y0}
>}
::X
~/scripts> X instproc init {args} { puts "[self] init '$args'"; next }
~/scripts> X instproc y {args} {
> set x [next]
> puts "[self] y '$args'"
> set x
>}
~/scripts> X create x -y y1
::x y 'y0'
::x y 'y1'
::x init ''
::x
=============================
however, most probably it is not doing what you might be expecting.
your method y overwrites the setter method of parameter y, therefore in
this example, not much happens in the next of method y.
maybe you had in mind to overload the setter/getter method, which you can
do e.g. with a mixin (see below)
Class X -parameter {
{y y0}
} -instmixin [Class new -instproc y args {
puts "[self] [self proc] $args"
set x [next]
puts "[self] [self proc] $args setter returns <$x>"
return $x
}]
X create x -y y1
puts x.y=[x set y]