Hi, if I import all the class commands from a namespace this causes an
error
claiming that all the class commands already exists. Consider the script:
package require itcl
package require itk
namespace import itk::*
itcl::class Test {
inherit itk::Toplevel
constructor {args} {
puts "Construction: $this -> $args"
eval itk_initialize $args
}
destructor {
puts "Destruction: $this"
}
}
Test .t -title "New window"
When I run this against itcl-ng (with tcl8.6) I get the error:
Error in startup script: cannot inherit from "itk::Toplevel" (can't create
object "itk::Toplevel": command already exists with that nameITCL: cannot
create Tcl_NewObjectInstance for class "::itk::Toplevel")
while executing
"inherit itk::Toplevel"
(class "Test" body line 3)
invoked from within
"itcl::class Test {
inherit itk::Toplevel
constructor {args} {
puts "Construction: $this -> $args"
eval itk_initialize $args
}
..."
(file "itest.tcl" line 6)
Removing the "namespace import" line fixes the problem or moving
back to itcl 3.4.
Arnulf Wiedemann
Namespace usage
4.0*
Public
|
Date: 2009-11-03 18:32 reopened as no final solution yet. |
|
Date: 2009-11-03 02:21 This Tracker item was closed automatically by the system. It was |
|
Date: 2009-10-22 07:51 Donal, I agree fully with your argumentation. Problem with deleting the |
|
Date: 2009-10-21 12:44 Refusing to magically delete an old command by accident is a designed-in |
|
Date: 2009-10-19 15:17 I have tracked down the problem. When calling namespace import command, |
| Filename | Description | Download |
|---|---|---|
| itest.tcl | test script | Download |
| Field | Old Value | Date | By |
|---|---|---|---|
| close_date | 2009-11-03 02:21 | 2009-11-03 18:32 | wiede |
| allow_comments | 0 | 2009-11-03 18:32 | wiede |
| status_id | Closed | 2009-11-03 18:32 | wiede |
| close_date | 2009-10-19 15:17 | 2009-11-03 02:21 | sf-robot |
| allow_comments | 1 | 2009-11-03 02:21 | sf-robot |
| status_id | Pending | 2009-11-03 02:21 | sf-robot |
| close_date | - | 2009-10-19 15:17 | wiede |
| status_id | Open | 2009-10-19 15:17 | wiede |
| assigned_to | mmclennan | 2009-08-20 11:03 | pwdraper |
| File Added | 339202: itest.tcl | 2009-08-14 14:00 | pwdraper |