The R Project SVN R

Rev

Rev 38057 | Rev 39360 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 38057 Rev 38402
Line 11... Line 11...
11
\usage{
11
\usage{
12
callNextMethod(...)
12
callNextMethod(...)
13
}
13
}
14
\arguments{
14
\arguments{
15
  \item{\dots}{
15
  \item{\dots}{
16
Optionally, the arguments to the function in its next call
16
    Optionally, the arguments to the function in its next call
17
(but note that the dispatch is as in the detailed description below;
17
    (but note that the dispatch is as in the detailed description below;
18
the arguments have no effect on selecting the next method.) 
18
    the arguments have no effect on selecting the next method.) 
19
 
19
 
20
If no arguments are included in the call to \code{callNextMethod}, the
20
    If no arguments are included in the call to \code{callNextMethod}, the
21
    effect is to call the method with the current arguments.
21
    effect is to call the method with the current arguments.
22
    See the detailed description for what this really means.
22
    See the detailed description for what this really means.
23
 
23
 
24
Calling with no arguments is often the natural way to use
24
    Calling with no arguments is often the natural way to use
25
    \code{callNextMethod}; see the examples.
25
    \code{callNextMethod}; see the examples.
26
    }
26
    }
27
}
27
}
28
\details{
28
\details{
29
  The \dQuote{next} method (i.e., the first inherited method) is defined to
29
  The \dQuote{next} method (i.e., the first inherited method) is defined
30
    be that method
-
 
31
  which \emph{would} have been called if the current method did not
30
  to be that method which \emph{would} have been called if the current
32
  exist.
-
 
33
  This is more-or-less literally what happens: The current method
31
  method did not exist. This is more-or-less literally what happens: The
-
 
32
  current method (to be precise, the method with signature given by the
34
  (to be precise, the method with signature given by the \code{defined} slot of the method from which \code{callNextMethod} is called)
33
  \code{defined} slot of the method from which \code{callNextMethod} is
35
  is
-
 
36
  deleted from a copy of the methods for the current generic, and
34
  called) is deleted from a copy of the methods for the current generic,
37
  \code{\link{selectMethod}} is called to find the next method (the
35
  and \code{\link{selectMethod}} is called to find the next method (the
38
  result is cached in a special object, so the search only typically
36
  result is cached in a special object, so the search only typically
39
  happens once per session per combination of argument classes).
37
  happens once per session per combination of argument classes).
40
 
38
  
-
 
39
  Note that the preceding definition means that the next method is
-
 
40
  defined uniquely when \code{setMethod} inserts the method containing
41
Note that the preceding definition means that the next method is defined uniquely when \code{setMethod} inserts the method containing the \code{callNextMethod} call, given the definitions of the classes in the signature.
41
  the \code{callNextMethod} call, given the definitions of the classes
-
 
42
  in the signature. The choice does not depend on the path that gets us
42
The choice does not depend on the path that gets us to that method (for example, through inheritance or from another \code{callNextMethod} call).
43
  to that method (for example, through inheritance or from another
-
 
44
  \code{callNextMethod} call). This definition was not enforced in
43
This definition was not enforced in versions of R up to 2.3.0, where the method was selected based on the target signature, and so could vary depending on the actual arguments.
45
  versions of \R prior to 2.3.0, where the method was selected based on
-
 
46
  the target signature, and so could vary depending on the actual
-
 
47
  arguments.
44
 
48
 
45
  It is also legal, and often useful, for the method called by
49
  It is also legal, and often useful, for the method called by
46
  \code{callNextMethod} to itself have a call to
50
  \code{callNextMethod} to itself have a call to
47
  \code{callNextMethod}. This generally works as you would expect, but
51
  \code{callNextMethod}. This generally works as you would expect, but
48
  for completeness be aware that it is possible to have ambiguous
52
  for completeness be aware that it is possible to have ambiguous