From hothorn at ci.tuwien.ac.at  Tue Aug 12 13:10:46 2003
From: hothorn at ci.tuwien.ac.at (Torsten Hothorn)
Date: Tue Aug 12 12:10:23 2003
Subject: [Rd] tracing nonstandardGenericFunction
Message-ID: <Pine.LNX.3.96.1030812120527.31272D-100000@thorin.ci.tuwien.ac.at>


Hi, 

how can one trace a nonstandardGenericFunction,
especially "initialize"? An example:

setClass("dummy", representation(a = "numeric"))

setMethod("initialize", "dummy", 
          function(.Object, a = 2) { ### I want to trace this function
              .Object@a <- a
              .Object
          })

setMethod("show", "dummy", function(object) print(object@a))

b <- new("dummy", a = 3)

trace("show", browser, signature = "dummy") ### trace method "show" to
                                            ### class "dummy"

show(b) ### works fine

trace("initialize", browser, signature = "dummy")

R> b <- new("dummy") ### does not trace the function of interest ...
Tracing initialize(value, ...) on entry 
Called from: initialize(value, ...)

Best,

Torsten


[Rd] tracing nonstandardGenericFunction
Torsten Hothorn