Thank you, Professor, for drawing my attention to the nifty tracemem function. I'm using the ..1 syntax to check the properties of the S4 class at function call. The Description at ?"cBind" tells me that I'm not alone in this predicament. Just as Matrix needs its own cBind function, my package will need its own cbindMondate function. Alas, subclasses of mondate will also need their own binding functions, thus defeating one of the purposes of the class paradigm (for binding, anyway). As an aside, I wonder why, on around line 75, cBind uses 'rep.int("", ncol(r))' rather than the slightly faster 'character(ncol(r))'. Thanks again, Dan On Sun, Jul 4, 2010 at 4:36 AM, Prof Brian Ripley wrote: > I think you have missed the use of ..1 etc: see e.g. cBind() in package > Matrix. > > So x <- attr(list(...)[[1L]], "foo") can be x <- attr(..1, "foo") > > As for 'extra copying', it all depends on exactly what you are doing, but > compare > > foo1 <- function(...) length(..1) >> foo2 <- function(...) length(list(...)[[1L]]) >> tracemem(x <- runif(1000)) >> > [1] "<0x1b27800>" > >> foo1(x) >> > [1] 1000 > >> tracemem(x <- runif(1000)) >> > [1] "<0x1b29800>" > >> foo2(x) >> > tracemem[0x1b29800 -> 0x10a2200]: foo2 > [1] 1000 > > > > > -- > Brian D. Ripley, ripley@stats.ox.ac.uk > Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ > University of Oxford, Tel: +44 1865 272861 (self) > 1 South Parks Road, +44 1865 272866 (PA) > Oxford OX1 3TG, UK Fax: +44 1865 272595 > [[alternative HTML version deleted]]