Hello all.

A few days ago, I submitted a problem which remains unsolved although somebody answered to my question. I still have the problem. Can someone please explain if something is wrong ?

Have a look at this example:

setGeneric("f",valueClass="NULL",def=function(x) standardGeneric("f"))

setMethod("f",signature(x="A"),def=function(x)
{
   a = x...@a
   cat("nombre :",a,"\n")
}
)

setMethod("f",signature(x="B"),def=function(x)
{
   cat("mot :",x...@b,"\n")
   callNextMethod()
}
)

a = new("A",a=1)
b = new("B",b="hello",a)

f(a)
f(b)

This last command (f(b)) fails. But remove the 'valueClass="NULL"' setting in setGeneric or add argument x to the call to callNextMethod and it will be OK! Isn't it tricky?

Thanks in advance for any help.

Harold

--
*********************************************************
Harold PETITHOMME
Equipe Données et Outils de Prévision (DPREVI/COMPAS/DOP)

Météo France - Direction de la Production
42, avenue G. Coriolis.
31057 Toulouse Cedex
France

Tel : (33/0)5.61.07.82.85
Fax : (33/0)5.61.07.86.09
E-mail : harold.petitho...@meteo.fr

______________________________________________
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel

Reply via email to