Tcl Library Source Code

View Ticket
Bounty program for improvements to Tcl and certain Tcl packages.
Tcl 2019 Conference, Houston/TX, US, Nov 4-8
Send your abstracts to [email protected]
or submit via the online form by Sep 9.
Ticket UUID: 1397543
Title: Snit v2 not handling tcl8.5 return -options
Type: Bug Version: None
Submitter: nobody Created on: 2006-01-05 07:49:56
Subsystem: snit Assigned To: duquette
Priority: 5 Medium Severity:
Status: Open Last Modified: 2006-01-05 07:49:56
Resolution: None Closed By:
    Closed on:
Since snitv2 runs under tcl8.5, I think CallInstance
needs to handle the extended error options available
under 8.5, so suggest the following amendment:

proc ::snit::RT.CallInstance {selfns args} {
    upvar ${selfns}::Snit_instance self

    set retval [catch {uplevel 1 [linsert $args 0
$self]} result eo]

    if {$retval} {
            return -code $retval -options $eo $result

    return $result

Although, now I think about it, it doesn't really make
sense to trap the errors merely to re-throw them, so it
might be best to just make it this:

proc ::snit::RT.CallInstance {selfns args} {
    upvar ${selfns}::Snit_instance self

    return [uplevel 1 [linsert $args 0 $self]]

Or even this:

proc ::snit::RT.CallInstance {selfns args} {
    upvar ${selfns}::Snit_instance self

    return [$self {expand}$args]