From harold.petithomme at meteo.fr  Mon Oct  4 12:49:18 2010
From: harold.petithomme at meteo.fr (Harold Petithomme)
Date: Mon, 04 Oct 2010 12:49:18 +0200
Subject: [Rd] Unexplained strange behaviour of callNextMethod in S4 methods
In-Reply-To: <cpnk4m8muyp.fsf@gmail.com>
References: <4C9B6257.8070500@meteo.fr> <cpnk4m8muyp.fsf@gmail.com>
Message-ID: <4CA9B12E.6000902@meteo.fr>

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 at a
    cat("nombre :",a,"\n")
}
)

setMethod("f",signature(x="B"),def=function(x)
{
    cat("mot :",x at 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.petithomme at meteo.fr



[Rd] Unexplained strange behaviour of callNextMethod in S4 methods
Harold Petithomme