[Rd] Bug in 'setRefClass()' regarding how args in '...' are passed to 'setClass()'?

Janko Thyson janko.thyson.rstuff at googlemail.com
Wed Aug 24 11:35:24 CEST 2011


Dear list,

in ?setRefClass it says that '...' can be used to supply other arguments 
that are passed to 'setClass()'.

Yet, I think that's not true for argument 'prototype', but maybe I 
overlooked something:

setClass("Plugin")
setClass(Class="PluginDefault", contains="Plugin",
     representation=representation(.PRIMARY="function"),
     prototype=prototype(.PRIMARY=function(src) src)
)
PluginDefault <- function() new("PluginDefault")
PluginDefault()
PluginDefault()$.PRIMARY    # Desired prototype content

#+++++ START A NEW R SESSION BEFORE CONTINUING

setRefClass("Plugin")
setRefClass(Class="PluginDefault", contains="Plugin", 
fields=list(.PRIMARY="function"),
     prototype=prototype(.PRIMARY=function(src) src)
)
PluginDefault <- function() new("PluginDefault")
PluginDefault()
PluginDefault()$.PRIMARY     # No prototype content

Regards,
Janko



More information about the R-devel mailing list