beetlebug▾
/

info object

Gives facts about a TclOO object.

info object SUBCOMMAND OBJECT ?ARG ...?

Description

Gives a fact about the object OBJECT. The subcommands are call, class, definition, filters, forward, isa, methods, methodtype, mixins, namespace, variables, and vars, as info object of Tcl 8.6. For example, class gives the class of the object, vars gives the variables of its namespace, and isa tests a fact such as isa object or isa typeof.

info object isa object NAME and info object isa typeof NAME CLASS give 0 for a NAME with no object, and class, methods, and vars give an error for it.

Arguments

ArgumentTypeDefaultDescription
OBJECTobject namerequiredThe object.

Returns

The fact, by the subcommand.

Examples

% oo::class create Pt {variable x; constructor {} {set x 0}}
> Pt create p1
> list [info object class p1] [info object vars p1] [info object isa typeof p1 Pt]
::Pt x 1

% info object isa object nope
0

Errors

% info object
wrong # args: should be "info object subcommand ?arg ...?"
-errorcode TCL WRONGARGS

% info object bogus o
unknown or ambiguous subcommand "bogus": must be call, class, definition, filters, forward, isa, methods, methodtype, mixins, namespace, variables, or vars
-errorcode TCL LOOKUP SUBCOMMAND

% info object class nope
nope does not refer to an object
-errorcode TCL LOOKUP OBJECT nope

Facts

Capability
None.
Tcl release
Tcl 9.1 and 8.6.
Since
ztcl 1.0.0-beta.1

See also