[Rcpp-commits] r1386 - pkg/Rcpp/R

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Mon May 31 22:00:04 CEST 2010


Author: romain
Date: 2010-05-31 22:00:02 +0200 (Mon, 31 May 2010)
New Revision: 1386

Modified:
   pkg/Rcpp/R/Module.R
Log:
need to use callNextMethod otherwise bad things happen

Modified: pkg/Rcpp/R/Module.R
===================================================================
--- pkg/Rcpp/R/Module.R	2010-05-31 18:56:29 UTC (rev 1385)
+++ pkg/Rcpp/R/Module.R	2010-05-31 20:00:02 UTC (rev 1386)
@@ -105,7 +105,8 @@
 		for( i in seq_along(classes) ){
 			CLASS <- classes[[i]]
 			setClass( clnames[i], contains = "C++Object", where = where )
-			init <- function(.Object, ...){
+			setMethod( "initialize", clnames[i], function(.Object, ...){
+				.Object <- callNextMethod()
 				if( .Call( "CppObject__needs_init", .Object at pointer, PACKAGE = "Rcpp" ) ){
 					out <- new_CppObject_xp( CLASS, ... )
 					.Object at pointer <- out$xp
@@ -113,8 +114,7 @@
 					.Object at module <- CLASS at module
 				}
 				.Object
-			}
-			setMethod( "initialize", clnames[i], init , where = where )
+			} , where = where )
 			
 			METHODS <- .Call( "CppClass__methods" , CLASS at pointer , PACKAGE = "Rcpp" )
 			if( "[[" %in% METHODS ){



More information about the Rcpp-commits mailing list