From p.dalgaard@biostat.ku.dk  Wed Apr 14 23:17:11 1999
From: p.dalgaard@biostat.ku.dk (Peter Dalgaard BSA)
Date: 15 Apr 1999 00:17:11 +0200
Subject: R's UseMethod() does not dispatch on changed class() (PR#167)
In-Reply-To: Robert Gentleman's message of "Wed, 14 Apr 1999 10:29:54 -0400 (EDT)"
References: <Pine.SV4.4.05.9904141016170.18981-100000@hsph.harvard.edu>
Message-ID: <x2ogkqlue0.fsf@blueberry.kubism.ku.dk>

Robert Gentleman <rgentlem@hsph.harvard.edu> writes:

> Do you really want to have a language that accepts any change in x?
> It is rather hard to see how it's object oriented then!
> Or, alternatively do you really want to see if the only thing that
> has changed about x is its class and that will be ok?
> What about the other arguments?
> The whole point of UseMethod is that we got an object x, with a
> particular class and now we're going to do the right thing.
> If you wanted to do the right thing with an object of a different
> class then you need to do that before you call UseMethod.

I'm inclined to agree here. On the other hand, what might be the case
is that you could make class<- be a little more careful with its
argument so that UseMethod would see the modified x. Sneaky, but
compatible, and *perhaps* not very hard to do. How often is this kind
of construct (class(x)<-foo;UseMethod()) used in actual S code?

> Semantically different, well documented and if Joe User doesn't
> understand it's because S doesn't do what it says it does and
> people write bad code (but generally not as bad as mine ;-).

- and Joe User generally gets in trouble with methods anyway...

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


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