beetlebug▾
/

info class

Gives facts about a TclOO class.

info class SUBCOMMAND CLASS ?ARG ...?

Description

Gives a fact about the class CLASS. The subcommands are call, constructor, definition, destructor, filters, forward, instances, methods, methodtype, mixins, subclasses, superclasses, and variables, as info class of Tcl 8.6. For example, methods gives the public methods that the class defines, -private adds the private ones, and -all adds the methods that the class gets from its superclasses.

A CLASS that is an object but not a class is an error, and so is a name with no object.

Arguments

ArgumentTypeDefaultDescription
CLASSclass namerequiredThe class.

Returns

The fact, by the subcommand.

Examples

% oo::class create Pt {variable x; method move {d} {incr x $d}; method Hid {} {}}
> list [info class methods Pt] [lsort [info class methods Pt -private]]
move {Hid move}

% oo::class create Pb; info class superclasses Pb
::oo::object

% oo::class create Pc {method move {d} {incr x $d}}
> info class definition Pc move
d {incr x $d}

Errors

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

% info class bogus C
unknown or ambiguous subcommand "bogus": must be call, constructor, definition, destructor, filters, forward, instances, methods, methodtype, mixins, subclasses, superclasses, or variables
-errorcode TCL LOOKUP SUBCOMMAND

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

% oo::object create p1; info class methods p1
"p1" is not a class
-errorcode TCL LOOKUP CLASS p1

Facts

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

See also