Menu

#726 Snit v2 not handling tcl8.5 return -options

open
snit (26)
5
2006-01-05
2006-01-05
Anonymous
No

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]
}

Discussion