isSealedMethod            package:methods            R Documentation

_C_h_e_c_k _f_o_r _a _S_e_a_l_e_d _M_e_t_h_o_d _o_r _C_l_a_s_s

_D_e_s_c_r_i_p_t_i_o_n:

     These functions check for either a method or a class that has been
     _sealed_ when it was defined, and which therefore cannot be
     re-defined.

_U_s_a_g_e:

     isSealedMethod(f, signature, fdef, where)
     isSealedClass(Class, where)

_A_r_g_u_m_e_n_t_s:

       f: The quoted name of the generic function. 

signature: The class names in the method's signature, as they would be
          supplied to 'setMethod'. 

    fdef: Optional, and usually omitted:  the generic function
          definition for 'f'. 

   Class: The quoted name of the class.

   where: where to search for the method or class definition.  By
          default, searches from the top environment of the call to
          'isSealedMethod' or 'isSealedClass', typically the global
          environment or the name space of a package containing a call
          to one of the functions.

_D_e_t_a_i_l_s:

     In the R implementation of classes and methods, it is possible to
     seal the definition of either a class or a method.  The basic
     classes (numeric and other types of vectors, matrix and array
     data) are sealed.  So also are the methods for the primitive
     functions on those data types.  The effect is that programmers
     cannot re-define the meaning of these basic data types and
     computations.  More precisely, for primitive functions that depend
     on only one data argument, methods cannot be specified for basic
     classes.  For functions (such as the arithmetic operators) that
     depend on two arguments, methods can be specified if _one_ of
     those arguments is a basic class, but not if both are.

     Programmers can seal other class and method definitions by using
     the 'sealed' argument to 'setClass' or 'setMethod'.

_V_a_l_u_e:

     The functions return 'FALSE' if the method or class is not sealed
     (including the case that it is not defined); 'TRUE' if it is.

_R_e_f_e_r_e_n_c_e_s:

     Chambers, John M. (2008) _Software for Data Analysis: Programming
     with R_ Springer.  (For the R version.)

     Chambers, John M. (1998) _Programming with Data_ Springer (For the
     original S4 version.)

_E_x_a_m_p_l_e_s:

     ## these are both TRUE
     isSealedMethod("+", c("numeric", "character"))
     isSealedClass("matrix")

     setClass("track",
                 representation(x="numeric", y="numeric"))
     ## but this is FALSE
     isSealedClass("track")
     ## and so is this
     isSealedClass("A Name for an undefined Class")
     ## and so are these, because only one of the two arguments is basic
     isSealedMethod("+", c("track", "numeric"))
     isSealedMethod("+", c("numeric", "track"))

