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

Luke Tierney luke@nokomis.stat.umn.edu
Wed, 12 Dec 2001 09:51:46 -0600


I don't think I'll get to look at this cerefully today, but here is
just a thought: My recollection is that NextMethod needs to be called
only from within a usemethod dispatch because the dispatch needs to
set up stuff in the environment that NextMethod needs.  If you do

print.a <- function(...) NextMethod()

and then call print.a directly then the stuff NextMethod needs isn't
set up, so NextMethod can't do anything useful.  I think the
do_nextmethod tries to detect this and raise an error, but for some
reason it isn't detecting the problem here.

luke

On Wed, Dec 12, 2001 at 02:11:07PM +0100, Peter Dalgaard BSA wrote:
> Rich Heiberger <rmh@surfer.sbm.temple.edu> writes:
> 
> > Peter, your explanation looks right to me, and is certainly consistent
> > with the crash behavior of
> > get("print.a")
> > The R-1.4.0 error message is a good check.
> > 
> > I would think the explanation should prevent the other example from
> > working as well.  But this one works
> > get("print.factor")(tmp)
> > exactly as expected.
> > 
> > Both of these examples work correctly in S-Plus 4.5
> 
> (S-PLUS 3.4 too)
> 
> There's no NextMethod in print.factor, but I was wrong on the other
> example: It has NextMethod("print",....) with an explicit generic, so
> I don't think it should go near the CAR(call) bit at all.
> 
> I'll take a closer look, but there's also a few other nasty bugs
> nagging us at the moment, and this looks like it could require surgery
> to do_nextmethod with some risk of complications.
> 
> -- 
>    O__  ---- Peter Dalgaard             Blegdamsvej 3  
>   c/ /'_ --- Dept. of Biostatistics     2200 Cph. N   
>  (*) \(*) -- University of Copenhagen   Denmark      Ph: (+45) 35327918
> ~~~~~~~~~~ - (p.dalgaard@biostat.ku.dk)             FAX: (+45) 35327907
> -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
> 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
> _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._

-- 
Luke Tierney
University of Minnesota                      Phone:           612-625-7843
School of Statistics                         Fax:             612-624-8868
313 Ford Hall, 224 Church St. S.E.           email:      luke@stat.umn.edu
Minneapolis, MN 55455 USA                    WWW:  http://www.stat.umn.edu
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._