Search code examples
tclincr-tclitcl

::itcl::delete throws error "invalid command name"


I am using itcl delete command to delete objects and classes. However, tcl interpreter says "invalid command name "delete". Here is the partial code snippet.

% itcl::find classes
datapath point datapath_point
itcl::find objects
datapath_point0 datapath_point1 datapath0
% itcl::delete object datapath_point0
invalid command name "delete"

Thanks, boppu


Solution

  • With Peter, comments I could look for the Error in my code. In one of the base class, I had the following code.

    destrutor {
    delete object $this
    }
    

    Here, delete namespace was missing. Even though you add "itcl::delete", you will endup in another error. Simple and correct solution should be an empty destructor.

    destructor {
    }