|
2007-11-09
| ||
| 20:58 | • Closed ticket [1824958fff]: self.export problem (?) plus 3 other changes artifact: 7824afab82 user: dkf | |
| 18:02 | • Ticket [1824958fff]: 5 changes artifact: 5eee35cfdd user: dkf | |
| 17:32 | • Ticket [1824958fff]: 4 changes artifact: a031e0766f user: jima00 | |
|
2007-11-02
| ||
| 23:35 | • New ticket [1824958fff]. artifact: 2c7cc2c670 user: jima00 | |
self.export problem (?)
Closed / Fixed1824958fffffffffffffffffffffffffffffffffCreated 19 years agoUpdated 19 years ago
Descriptionplain2007-11-02 23:35:47
is this a problem with self.export?
package require TclOO
namespace import ::oo::*
class create ::WEA {
method WEA {
args
} {
puts {*}$args
}
}
define ::WEA self.export WEA
::WEA WEA WEA
unknown method "WEA": must be WEA, create, destroy or new
jima00plain2007-11-09 17:32:30
Logged In: YES
user_id=1928331
Originator: YES
I think it might be related with the observation things go different having used create or define upon objects in TclOO.
Here is an example of what I mean:
package require TclOO
::oo::object create ::OBJ {
method FOO {args} {puts {*}$args}
}
puts "Methods: [info object methods ::OBJ -all]" ;# <---- GIVES "Methods: "
::oo::define ::OBJ {
method BAR {args} {puts {*}$args}
}
puts "Methods: [info object methods ::OBJ -all]" ;# <---- GIVES "Methods: BAR"
Is this as intended to be?
Should I always use "new" and then ::oo::define everything apart?
Thanks in advance.
dkfplain2007-11-09 18:02:25
Logged In: YES
user_id=79902
Originator: NO
OK, there's a few problems here.
Firstly, in your issue below the problem is that the default constructor for oo::object does absolutely nothing at all, and ignores all arguments. Use a subclass of oo::object to define your own behaviour, perhaps like this:
oo::class create myObject {
constructor {script} {::oo::define [self] $script}
}
Secondly, the main point of this bug report *is* a bug. The bug is that the "export record" for the undefined object method "WEA" is being interpreted as a real method when generating the error message. Oops!
dkf Closed ticket [1824958fff].
[History diff]2007-11-09 20:58:21
Log in (anonymous is fine) to add a comment.