Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: 522ecb99dc7cf0083691f0a1c38e89a2818dcc10
Ticket: 1706593fffffffffffffffffffffffffffffffff
autoloading causes (itcl) 'class already exists' error
User & Date: legolas_a20 on 2007-04-24 13:16:16
Changes

  1. assignee changed to: "dgp"
  2. cmimetype changed to: "text/plain"
  3. comment changed to:
    
    There is a 'bug' in the itcl implementation of auto_mkindex_parser::command, that causes an error message saying:
    class "::A" already exists
    if it is combined with a simple error in the itcl class and autoloading.
    
    
    I realize this is not completely a tcl core problem, however the autoload package already appears to try to 'defend' against errors in external parser commands, and if this case could also be caught, it could return a much better error message.
    
    Example in the attachment, in short: itcl allows you to declare a proc but implement it later (C++ style separation of header and implementation). itcl has implemented the parsing for autoload by adding the proc to the autoload list when the declaration is seen (probably because you can also implement the proc inline with the declaration, again matching C++ style.)
    
    Now, if you declare but not implement a proc, it is listed in the tclindex file, but after sourcing the file, the command is still not defined. However, the current checks against this all pass.
    Then, the command is started, causing a recursive call into the autoload code, which sources the file again, which results in the error.
    
    (I have tried to reproduce this without itcl, but haven't been able to. I don't fully understand how itcl creates it's class procedures as tcl procs and namespaces, and how this succeeds in bypassing the existing checks.)
    
    Note: tested using itcl 3.3, everything was installed by activestate's 8.4.14 tcl installer, on windows xp sp2.
    
  4. foundin changed to: "obsolete: 8.4.14"
  5. is_private changed to: "0"
  6. priority changed to: "5 Medium"
  7. resolution changed to: "None"
  8. status changed to: "Open"
  9. submitter changed to: "legolas_a20"
  10. subsystem changed to: "38. Init - Library - Autoload"
  11. title changed to:
    autoloading causes (itcl) 'class already exists' error
    
  12. type changed to: "Bug"