Itcl - the [incr Tcl] extension

View Ticket
Login
Ticket Hash: f8296373502df0656f70ba69f82ef0eceab0f920
Title: itcl::ensemble command overwrites Tk option command.
Status: Closed Type: Code_Defect
Severity: Severe Priority: Immediate
Subsystem: Resolution: Fixed
Last Modified: 2015-07-29 22:57:24
Version Found In: 4.0.3
User Comments:
griffin added on 2015-07-27 14:28:34:
Problem demonstration:

$ wish8.6 
% package require itcl 
4.0.3 
% option 
wrong # args: should be "option cmd arg ?arg ...?" 
% option get . foreground Foreground 
#000000 
% itcl::ensemble itcl::delete { part foo {args} {puts Hi!} } 
% option get . foreground Foreground 
wrong # args: should be "option name args body"

dgp added on 2015-07-27 20:20:14:
Thanks for the patch.

Itcl 3 sources use Tcl_CreateInterp() call for the same purpose.

Any reason to choose one over the other?

dgp added on 2015-07-27 20:24:30:
Answer my own Q....  Using Tcl_CreateSlave() will setup
cleanup operations automatically?

dgp added on 2015-07-27 20:29:12:
Oops!  Did you try this patch?

ensemble.test


==== ensemble-1.4 invoking ensemble parts FAILED
==== Contents of test case:

    list [test_numbers one 1] [test_numbers two 2 3] [test_numbers three 3 4 5]

---- Test generated error; Return code was: 1
---- Return code should have been one of: 0 2
---- errorInfo: invalid command name "::itcl::internal::commands::ensembles::9::one"
    while executing
"test_numbers one 1"
    ("uplevel" body line 2)
    invoked from within
"uplevel 1 $script"
---- errorCode: TCL LOOKUP COMMAND ::itcl::internal::commands::ensembles::9::one
==== ensemble-1.4 FAILED



==== ensemble-1.5 invoking parts with improper arguments FAILED
==== Contents of test case:

    set res [catch "test_numbers three x" msg]
    lappend res [string match "wrong # args*" $msg]

---- Result was:
1 0
---- Result should have been (exact matching):
1 1
==== ensemble-1.5 FAILED

Test file error: child killed: segmentation violation

griffin added on 2015-07-27 21:30:32:
I have not tested it yet.  I'm still trying to get my code to execute.  This fix at least get's me past the [source] command and starts running the program.  All I can say right now is that "it compiles." :)

dgp added on 2015-07-29 22:57:24:
Corrected patch committed to trunk.

Attachments: