[Xotcl] Is this a bug?

Gustaf Neumann neumann at wu-wien.ac.at
Thu Dec 8 12:43:22 CET 2005


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]



More information about the Xotcl mailing list