[Rd] crash bug in get("function.name")() (PR#1211)

Prof Brian D Ripley ripley@stats.ox.ac.uk
Fri, 14 Dec 2001 06:31:19 +0000 (GMT)


On Thu, 13 Dec 2001, Rich Heiberger wrote:

> I tried the same exercise in S-Plus 6.  S-Plus 6 rejects any direct use
> of a method.  It requires use of the generic.  It provides an error message

It only does that for S4-style formal methods, but some care is needed
with S3-style ones.

> that might make sense to us, but probably not to a user.  The message
> is consistent with Luke's intuition of coming into the middle of a sequence
> that was not properly initiated with UseMethod.
>
> Professional Edition Version 6.0.3 Release 2 for Microsoft Windows : 2001
>
> > tmp <- factor(1:3)
> > tmp
> [1] 1 2 3
> > print.factor(tmp)
> Warning messages:
>   the "..." object should be a list but has mode "missing"
> Problem in NextMethod("print", quote = quote): argument "..1" is missing with no default
> Use traceback() to see the call stack
> > get("print.factor")(tmp)
> Warning messages:
>   the "..." object should be a list but has mode "missing"
> Problem in NextMethod("print", quote = quote): argument "..1" is missing with no default
> Use traceback() to see the call stack
> >

Well, it works if called properly:

print.factor(tmp, quote = F)
[1] 1 2 3

> get("print.factor")(tmp, quote = F)
[1] 1 2 3

The issue is to do with optimizing the evaluation of arguments, and
indeed whether the default is taken from the generic or the method.

Note that `S-Plus 6' is not a single entity: the behaviour of
method dispatch differs between 6.0.y versions.  Later ones are stricter
about argument sequence matching between methods and generics (and that is
why R's QA tools have a strict interpretation too, since they must now be
regarded as `standard S').


-- 
Brian D. Ripley,                  ripley@stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272860 (secr)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-devel-request@stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._