Sujet : Re: a typeof command for debugging?
De : ralfixx (at) *nospam* gmx.de (Ralf Fassel)
Groupes : comp.lang.tclDate : 22. Jun 2025, 12:08:53
Autres entêtes
Message-ID : <yga34bsav96.fsf@akutech.de>
References : 1 2 3
User-Agent : Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux)
* Mark Summerfield <
m.n.summerfield@gmail.com>
| I've incorporated that but I still have an actual bug. The catch always
| returns false (failed) so objects always get returned as list_or_str. Yet,
| if I use info object class directly it correctly returns the class name.
| So clearly I'm doing something wrong in the catch.
>
| proc typeof x {
| # puts "\n[tcl::unsupported::representation $x]"
| if {![catch {[info object class $x] name}]} {
| return $name
This looks suspicious: you are calling
[info object class $x]
and whatever that returns, you use as a command to call with argument 'name',
and discard the result. The variable $name should not be set when you hit
the return.
Did you rather mean
catch {info object class $x} name
?
R'