MethodsList             package:methods             R Documentation

_M_e_t_h_o_d_s_L_i_s_t _O_b_j_e_c_t_s

_D_e_s_c_r_i_p_t_i_o_n:

     These functions create and manipulate `MethodsList' objects, the
     objects used in R to store methods for dispatch. You should not
     call any of these functions from code that you want to port to
     S-Plus.  Instead, use the functions described in the references.

_U_s_a_g_e:

     MethodsList(.ArgName, ...)

     makeMethodsList(object, level=1)

     SignatureMethod(names, signature, definition)

     insertMethod(mlist, signature, args, def, whichMethods, fromClass, envir)

     matchArg(object, thisClass, mlist, ev)

     matchArgClass(Class, classes, methods)

     showMlist(mlist, includeDefs = TRUE, inherited = TRUE,
        classes, useArgNames, printTo = stdout() )

     print.MethodsList(x, ...)

     listFromMlist(mlist, prefix = list())

     linearizeMlist(mlist, inherited = TRUE)

     finalDefaultMethod(mlist, fname = "")

     mergeMethods(m1, m2)

_D_e_t_a_i_l_s:

     Note that `MethodsList' objects represent methods only in the R
     implementation.  You can use them to find or manipulate
     information about methods, but avoid doing so if you want your
     code to port to S-Plus.

_D_e_t_a_i_l_s:


     `_M_e_t_h_o_d_s_L_i_s_t': Create a MethodsList object out of the arguments.

          Conceptually, this object is a named collection of methods to
          be dispatched when the (first) argument in a function call
          matches the class corresponding to one of the names.  A
          final, unnamed element (i.e., with name `""') corresponds to
          the default method.

          The elements can be either a function, or another
          MethodsList.  In the second case, this list implies
          dispatching on the second argument to the function using that
          list, given a selection of this element on the first
          argument.  Thus, method dispatching on an arbitrary number of
          arguments is defined.

          MethodsList objects are used primarily to dispatch OOP-style
          methods and, in R, to emulate S4-style methods.


     `_S_i_g_n_a_t_u_r_e_M_e_t_h_o_d': construct a MethodsList object containing
          (only) this method, corresponding to the signature; i.e.,
          such that signature[[1]] is the match for the first argument,
          signature[[2]] for the second argument, and so on.  The
          string "missing" means a match for a missing argument, and
          "ANY" means use this as the default setting at this level.

          The first argument is the argument names to be used for
          dispatch corresponding to the signatures.


     `_i_n_s_e_r_t_M_e_t_h_o_d': insert the definition `def' into the MethodsList
          object, `mlist', corresponding to the signature. By default,
          insert it in the slot `which="methods"', but `cacheMethod'
          inserts it into the `which="allMethods"' slot (used for
          dispatch but not saved).


`_m_a_t_c_h_A_r_g, _m_a_t_c_h_A_r_g_C_l_a_s_s': Utility functions to match the object  or
     the class to the elements of a methods list. Used in finding
     inherited methods, and not meant to be called directly.


`_s_h_o_w_M_l_i_s_t': Prints the contents of the MethodsList.  If `includeDefs'
     the signatures and the corresonding definitions will be printed;
     otherwise, only the signatures.

     The function calls itself recursively.  `prev' is the previously
     selected classes.

`_l_i_s_t_F_r_o_m_M_l_i_s_t_F_o_r_P_r_i_n_t': Undo the recursive nature of the methods list,
     making a list of function defintions, with the names of the list
     being the corresponding signatures (designed for printing; for
     looping over the methods, use `listFromMlist' instead).

     The function calls itself recursively:  `prev' is the previously
     selected classes.


`_f_i_n_a_l_D_e_f_a_u_l_t_M_e_t_h_o_d' The true default method for the methods list
     object `mlist' (the method that matches class `"ANY"' for as many
     arguments as are used in methods matching for this generic
     function).

`_m_e_r_g_e_M_e_t_h_o_d_s' Merges the methods in the second MethodsList object into
     the first, and returns the merged result.  Called from
     `getAllMethods'. 

_A_u_t_h_o_r(_s):

     John Chambers

_R_e_f_e_r_e_n_c_e_s:

     The web page <URL: http://www.omegahat.org/RSMethods/index.html>
     is the primary documentation.

     The functions in this package emulate the facility for classes and
     methods described in Programming with Data, (John M. Chambers,
     Springer, 1998).  See this book for further details and examples.

_E_x_a_m_p_l_e_s:

