ref -- Implement reference counted objects in Tcl
The ref package allows you to implement reference counted objects and have those objects automatically destroyed when their last reference is released.
Creates a reference counted command object and returns a handle representing the object. The handle can be used as a Tcl command to invoke operations on the object. In practice, you should store the handle in a Tcl variable or pass it as an argument to another command.
The object delegates its operations to a Tcl command. The delegateCommand will be called with the arguments passed to the handle when the handle is used as a Tcl command.
If a destroyScript script is specified, it will be executed after the last reference to the object is released.
This command returns the internal representation type of the value passed as an argument. It is used for debugging purposes by the developer of this package to check the integrity of the objects.