[Xotcl] Weird behaviour

Gustaf Neumann neumann at wu-wien.ac.at
Thu Jan 5 15:13:24 CET 2006

i am somewhat confused be the code (why are you creating and deleting 
is the following code doing, what you are trying? (aggregates rooms on 
floors with a simple syntax)

package require XOTcl
namespace import -force ::xotcl::*

namespace eval tih {
  Class Floor \
      -instproc has cmds {eval $cmds}
  Class Room -superclass Class \
      -parameter {{count 0} currTemp} \
      -instproc new args {
    set name "[self callingobject]::[namespace tail [self]]-[my incr count]"
    eval [self] create $name $args

  Room room -parameter {{currTemp 300}}
  Room guestRoom -superclass room
  Room bathRoom -superclass room
  Room guestBathRoom -superclass bathRoom

  proc Celsius2Kelvin {a} { expr {$a+273.15} }

  Floor floor3 -has {
    guestRoom new
    guestBathRoom new -currTemp [Celsius2Kelvin 30]

  puts "rooms on floor 3: [floor3 info children]"
  foreach c [floor3 info children] {
    puts "temperature in room $c is [$c currTemp]"

More information about the Xotcl mailing list