[R] inheritence in S4

cgenolin at u-paris10.fr cgenolin at u-paris10.fr
Mon Mar 24 19:56:33 CET 2008


> The code example is incomplete, so I don't really know why one 
> version assigned y=3 for you and the other did not; for me, neither 
> version did the assignment.

I probably add the return in the mail without imagining il will change things.

My question was more on the use of ... versus the absence of ...
You anwer me by correcting my bug. So I can use callNextMethod with or 
without ... :

setClass("B",representation(y="numeric"))
setMethod("initialize","B",
          function(.Object,..., yValue){
              return(callNextMethod(.Object, ..., y=yValue))
          })

new("B",yValue=3)                   #1
try(new("B",yValueee=3))            #2 try(new("B",yValue=3,yValueee=3))   #3

setMethod("initialize","B",
          function(.Object, yValue){
              return(callNextMethod(.Object, y=yValue))
          })
new("B",yValue=3)                    #4
try(new("B",yValueee=3))             #5
try(new("B",yValue=3,yValueee=3))    #6

I undersand that 1 and 4 work. I understand that 2 and 5 do not work 
since yValue is missing
I understand that 6 does not work since yValueee is not a valid argument
But I would expect that 3 will work since it get a value for yValue and 
yValueee can be one of the ...

It does not...

Christophe

----------------------------------------------------------------
Ce message a ete envoye par IMP, grace a l'Universite Paris 10 Nanterre



More information about the R-help mailing list