0

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

boppu
  • 135
  • 2
  • 3
  • 9
  • Itcl version is: 3.4 – boppu Sep 07 '16 at 13:40
  • Not an `itcl` user, but does the destructor for `datapath_point` perchance invoke `delete` wrongly? Is there more of the stack trace to be inspected? – Peter Lewerin Sep 07 '16 at 18:29
  • Your guess was right. In one of the base classes, I have "delete object $this" in the destructor. – boppu Sep 08 '16 at 06:19
  • Yay! It would be a good thing if you wrote a self-answer to make it easier for others to find the solution. – Peter Lewerin Sep 08 '16 at 09:00
  • Okay. following was the code in one of the base class which was wrong. destructor { delete object $this }. Here, delete namescope was not specified so I was getting "unknown delete command" . Infact, this code is wrong it should be empty destructor as below: destructor { } – boppu Sep 08 '16 at 15:06
  • Very sorry, I was unclear. I meant for you to put that description in a "Your Answer" box and mark it as accepted. Doing so means that Stackoverflow changes the presentation of the question in the list to show others that the question has an answer, and an answer that works. If the answer is in the comments, people browsing the list will probably skip this item, because there is no indication of a solution. You're in no way obliged to do this, it's just a courtesy to others. – Peter Lewerin Sep 09 '16 at 04:36
  • @Peter, no worries. Answered the question as well.:-) – boppu Sep 09 '16 at 07:34

1 Answers1

1

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 {
}  
boppu
  • 135
  • 2
  • 3
  • 9