No registered users in community xowiki
in last 10 minutes
in last 10 minutes
RE: [Xotcl] Weird behaviour
From: Murr, Florian <florian.murr_at_siemens.com>
Date: Thu, 5 Jan 2006 16:30:40 +0100
Thanks a lot!
While trying to understand your suggestions, I further simplified my own
code and found the problem.
It was all my fault!
In the slave interpreter 'Celsius2Kelvin' is an unknown proc and
therefor a room-object with this name gets created and I got confused. -
I definitly have to get some rest soon :-)
Sorry for having bothered you and thanks for your suggestions!
- Florian
-----Original Message-----
From: Gustaf Neumann [mailto:neumann_at_wu-wien.ac.at]
Sent: Thursday, January 05, 2006 3:13 PM
To: Murr, Florian
Cc: xotcl_at_alice.wu-wien.ac.at
Subject: Re: [Xotcl] Weird behaviour
i am somewhat confused be the code (why are you creating and deleting
interpreters?)
is the following code doing, what you are trying? (aggregates rooms on
floors with a simple syntax)
-gustaf
===================================================
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]"
}
}
exit
Date: Thu, 5 Jan 2006 16:30:40 +0100
Thanks a lot!
While trying to understand your suggestions, I further simplified my own
code and found the problem.
It was all my fault!
In the slave interpreter 'Celsius2Kelvin' is an unknown proc and
therefor a room-object with this name gets created and I got confused. -
I definitly have to get some rest soon :-)
Sorry for having bothered you and thanks for your suggestions!
- Florian
-----Original Message-----
From: Gustaf Neumann [mailto:neumann_at_wu-wien.ac.at]
Sent: Thursday, January 05, 2006 3:13 PM
To: Murr, Florian
Cc: xotcl_at_alice.wu-wien.ac.at
Subject: Re: [Xotcl] Weird behaviour
i am somewhat confused be the code (why are you creating and deleting
interpreters?)
is the following code doing, what you are trying? (aggregates rooms on
floors with a simple syntax)
-gustaf
===================================================
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]"
}
}
exit