R's UseMethod() does not dispatch on changed class() (PR#167)

Robert Gentleman rgentlem@hsph.harvard.edu
Thu, 15 Apr 1999 16:32:28 -0400 (EDT)



On 15 Apr 1999, Peter Dalgaard BSA wrote:

> Erm, does that cover this case?:
> 
> >  f<-function(x){x<-2;print(substitute(x));UseMethod("print")}  
> > f(4)
> [1] 2
> [1] 4
> > f((4))
> (4)
> [1] 2
> 
> (It may, I'm just too tired to see it...)

  Wow! That's peculiar. 
  R does the rather boring

> f<-function(x){x<-2;print(substitute(x));UseMethod("print")}
> f(4)
[1] 2
[1] 4
> f((4))
[1] 2
[1] 4

  Does that mean that our implementaion of substitute is not quite
right? The documentation suggests that you get the expression typed as
the value of a formal argument; right now we're getting the current
value.

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._