[BioC] equivalent of $this

Martin Maechler maechler at stat.math.ethz.ch
Fri Sep 9 12:28:19 CEST 2005


>>>>> "Kasper" == Kasper Daniel Hansen <khansen at stat.Berkeley.EDU>
>>>>>     on Thu, 8 Sep 2005 21:32:16 -0700 writes:

    Kasper> If it is a redefinition of an existing method it
    Kasper> will (or rather it has to) use the arguments of the
    Kasper> existing general method. If you make you own method,
    Kasper> you choose what to call the arguments, but standard
    Kasper> says to call it object if it is a method only
    Kasper> accepting an object (or perhaps on object and a
    Kasper> value) - at least when you use S4 classes.

which "standard"?  I think it is  "common usage" at most;

I personally don't like that common usage so much and I'm rather
naming my function arguments either more according to their
contents, or then, for the first (few) arguments only, using
much shorter names such as  'x', 'y', etc.

Type
	library(fortune) # maybe after  install.package("fortune")
	fortune("dog")

for a funny variation on this theme...

Martin Maechler, ETH Zurich



    Kasper> M, TEXTORIS Julien wrote:

    >> Hi,
    >> 
    >> when programming with R and objects, when you describe a new class or
    >> method, does $this or an equivalent exists ? Sometimes, there is :
    >> 
    >> function(Object) (So Object is something equivalent to $this ?)
    >> function(.Object) (and .Object too ?)
    >> function(x,i,j,...) (and in this case x was equivalent to $this)
    >> 
    >> 
    >> I saw the last case in a redifinition of an existing method for the  
    >> new
    >> object created by myclass, and if i understand well, if a generic
    >> function was first described with function(x,i,j,...) one will  
    >> reutilize
    >> it, instead, if it's a new function, one will use Object or  
    >> either .Object ?
    >> 
    >> Is that true ?
    >> 
    >> thanks
    >> 
    >> Julien



More information about the Bioconductor mailing list