is(3itcl)
π NAME π
itcl::is β the lil vibe-check command that tells you if something is a class or an object π¦
β¨ SYNOPSIS β¨
itcl::is option ?arg arg ...?
πΈ DESCRIPTION πΈ
okay bestie so is is literally the detective of the itcl world πβ¨ you hand it an argument, you tell it which option you want, and it goes "yep" or "nope" for you.
- if the argument is a class or an object β you get
1back π - otherwise β you get
0π
and plot twist, is also recognizes commands that are wrapped up inside the itcl code command, so those count too π
the option argument is what decides which action actually gets carried out. here are the legal options (and yesss, they can be abbreviated, so you don't gotta type the whole thing) π
is class command
returns 1 if command is a class, and returns 0 otherwise π«Ά
β οΈ heads up bestie: you have to give the fully qualified name of the class as the command argument. so if a class lives inside a namespace, that namespace has to be specified too. fr fr, no shortcuts.
so if a class C resides in a namespace N, you'd call it like this:
is N::C
or
is ::N::C
is object ?-class className? command
returns 1 if command is an object, and returns 0 otherwise π
if you pass the optional -class parameter, then the command gets checked within the context of the class you gave. π«
π but note: className has to exist. if it doesn't, you're getting an error, periodt. so if you're not sure className is actually a class, you gotta check that it exists beforehand, or wrap the whole thing in a catch statement. protect yourself π
so, if c is an object in the class C, in namespace N, then these are all your possibilities (and every single one of them returns 1):
set obj [N::C c]
itcl::is object N::c
itcl::is object c
itcl::is object $obj
itcl::is object [itcl::code c]
π KEYWORDS π
class, object
and that's the whole page bestie, you ate that π this one's from itcl, version 3.3, and it's the is(3itcl) page β go forth and vibe-check your classes and objects ππ¦β¨
π¦ where this page comes from
- debian bookworm: tcl-itcl4-doc 4.2.3-1 Β· BSD-Tcl
- debian trixie: tcl-itcl4-doc 4.3.2-3 Β· BSD-Tcl
- ubuntu jammy: tcl-itcl4-doc 4.2.2-1 Β· BSD-Tcl
- ubuntu noble: tcl-itcl4-doc 4.2.4-1 Β· BSD-Tcl
- ubuntu questing: tcl-itcl4-doc 4.3.2-3
- ubuntu resolute: tcl-itcl4-doc 4.3.5-1 Β· BSD-Tcl
- ubuntu stonking: tcl-itcl4-doc 4.3.8-1 Β· BSD-Tcl
- Copyright (c) 1993-1998 Lucent Technologies, Inc
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms