From spinuvit.list at gmail.com  Sun Sep 26 16:37:50 2010
From: spinuvit.list at gmail.com (Vitally S.)
Date: Sun, 26 Sep 2010 16:37:50 +0200
Subject: [Rd] strange behaviour of callNextMethod in S4 methods
In-Reply-To: <4C9B6257.8070500@meteo.fr> (Harold PETITHOMME's message of "Thu, 
	23 Sep 2010 16:21:11 +0200")
References: <4C9B6257.8070500@meteo.fr>
Message-ID: <cpnk4m8muyp.fsf@gmail.com>

Harold PETITHOMME <harold.petithomme at meteo.fr> writes:

Hi,
>
> there is no more an error.
> Why does my "object" disappear?

I cannot reproduce your problem.

Here is an example identical to yours:

setClass("foo", list(a = "character", b = "numeric"), proto = 100,
         contains = "numeric")
setClass("boo", list(c = "numeric"), contains = "foo")


setGeneric("meth",
           def=function(variable, object, nc) standardGeneric("

setMethod("meth",signature(variable="ANY",object="numeric", nc="foo"),
            def=function(variable,object, nc)
            {
              nc at a <- as.character(variable)
              nc at b <- object+5
              nc
            }
            )

meth( 2432, 22, new("foo"))

setMethod("meth", signature(variable="ANY",object="numeric", nc="boo"),
            def=function(variable, object, nc)
            {
              nc at c <- object+10
              callNextMethod()
            }
            )
meth(4232, 22, new("boo")) ##works ok


Everything works as expected.

Vitaly.

>
> Thanks to all.
> Harold



[Rd] strange behaviour of callNextMethod in S4 methods
Vitally S.