is(3itcl)

πŸ“¦
version 4.3.8 Β· 2 versions
, in debian bookworm, debian trixie, ubuntu jammy, ubuntu noble, ubuntu questing, ubuntu resolute, ubuntu stonking

πŸ’– 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 1 back πŸŽ‰
  • 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