Go to main content

man pages section 1: User Commands

Exit Print View

Updated: Wednesday, July 27, 2022
 
 

my (1t)

Name

my - invoke any method of current object

Synopsis

package require TclOO

my methodName ?arg ...?

Description

my(1t)                          TclOO Commands                          my(1t)



______________________________________________________________________________

NAME
       my - invoke any method of current object

SYNOPSIS
       package require TclOO

       my methodName ?arg ...?
______________________________________________________________________________

DESCRIPTION
       The my command is used to allow methods of objects to invoke any method
       of the object (or its class). In particular, the set  of  valid  values
       for methodName is the set of all methods supported by an object and its
       superclasses, including those that are not exported.  The  object  upon
       which  the method is invoked is always the one that is the current con-
       text of the method (i.e. the object that is returned  by  self  object)
       from which the my command is invoked.

       Each  object  has  its own my command, contained in its instance names-
       pace.

EXAMPLES
       This example shows basic use of my to use the variables method  of  the
       oo::object class, which is not publicly visible by default:

              oo::class create c {
                  method count {} {
                      my variable counter
                      puts [incr counter]
                  }
              }
              c create o
              o count              -> prints "1"
              o count              -> prints "2"
              o count              -> prints "3"


ATTRIBUTES
       See attributes(7) for descriptions of the following attributes:


       +---------------+------------------+
       |ATTRIBUTE TYPE | ATTRIBUTE VALUE  |
       +---------------+------------------+
       |Availability   | runtime/tcl-8    |
       +---------------+------------------+
       |Stability      | Uncommitted      |
       +---------------+------------------+

SEE ALSO
       next(n), oo::object(n), self(n)

KEYWORDS
       method, method visibility, object, private method, public method




NOTES
       Source  code  for open source software components in Oracle Solaris can
       be found at https://www.oracle.com/downloads/opensource/solaris-source-
       code-downloads.html.

       This     software     was    built    from    source    available    at
       https://github.com/oracle/solaris-userland.   The  original   community
       source was downloaded from  http://prdownloads.sourceforge.net/tcl/tcl-
       core8.6.7-src.tar.gz.

       Further information about this software can be found on the open source
       community website at https://www.tcl.tk/.



TclOO                                 0.1                               my(1t)