Posted to tcl by cmcc at Tue Dec 09 20:44:51 GMT 2014view pretty

proc unbound {__text} {
    set __unbound {}
    while {$__text ne ""} {
	try {
	    dict with __unbound {
		subst -nocommands -nobackslashes $__text
	    }
	} trap {TCL LOOKUP VARNAME} {__e __eo} {
	    dict set __unbound [lindex [dict get $__eo -errorcode] end] \$[lindex [dict get $__eo -errorcode] end]
	} on error {e eo} {
	    puts stderr "$e ($eo)"
	    return -code error {*}$eo $e
	} on ok {} {
	    return $__unbound
	}
    }
}