ASPN ActiveState Programmer Network
  ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups | Web Services
SEARCH

Reference
ActiveTcl 8.5
ActiveTcl 8.5.4.0 User Guide
ActiveTcl 8.5.4.0 Documentation Index
[incr Tcl]
body
class
code
configbody
delete
ensemble
find
is
itcl
Itcl AppendList, Itcl InitList, Itcl AppendListElem, Itcl InsertList, Itcl CreateListElem, Itcl InsertListElem, Itcl DeleteList, Itcl DeleteListElem, Itcl SetListValue
Itcl CreateClass, Itcl FindClass, Itcl IsClass, Itcl DeleteClass, Itcl IsClassNamespace
Itcl DeleteObject, Itcl CreateObject, Itcl FindObject, Itcl IsObject, Itcl IsObjectIsa
Itcl EventuallyFree, Itcl PreserveData, Itcl ReleaseData
Itcl FindC, Itcl RegisterC, Itcl RegisterObjC
Itcl PeekStack, Itcl DeleteStack, Itcl InitStack, Itcl PopStack, Itcl PushStack, Itcl GetStackSize, Itcl GetStackValue
itclvars
local
scope

MyASPN >> Reference >> ActiveTcl 8.5 >> ActiveTcl 8.5.4.0 User Guide >> ActiveTcl 8.5.4.0 Documentation Index >> [incr Tcl]
ActiveTcl 8.5 documentation

[incr\ Tcl]

NAME

is - test argument to see if it is a class or an object

SYNOPSIS

itcl::is option ?arg arg ...?

DESCRIPTION

The is command is used to check if the argument given is a class or an object; depending on the option given. If the argument if a class or object, then 1 is returned. Otherwise, 0 is returned. The is command also recognizes the commands wrapped in the itcl code command.

The option argument determines what action is carried out by the command. The legal options (which may be abbreviated) are:

is class command
Returns 1 if command is a class, and returns 0 otherwise.
The fully qualified name of the class needs to be given as the command argument. So, if a class resides in a namespace, then the namespace needs to be specified as well. So, if a class C resides in a namespace N, then the command should be called like:
is N::C
    or
is ::N::C
is object ?-class className? command
Returns 1 if command is an object, and returns 0 otherwise.
If the optional "-class" parameter is specified, then the command will be checked within the context of the class given. Note that className has to exist. If not, then an error will be given. So, if className is uncertain to be a class, then the programmer will need to check it's existance beforehand, or wrap it in a catch statement.
So, if c is an object in the class C, in namespace N then these are the possibilities (all return 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
[ itcl ]
Copyright © 1989-1994 The Regents of the University of California.
Copyright © 1994-1996 Sun Microsystems, Inc.

Privacy Policy | Email Opt-out | Feedback | Syndication
© ActiveState 2004 All rights reserved