I was wondering if it's possible to get the object constructor from within an R6 object. One obvious way would be something like this:
test <- R6::R6Class('test',
public = list(initialize = function(myConst = test) private$myConst <- myConst),
private = list(myConst = NULL),
active = list(getConst = function()private$myConst))
but this looks to me really unsafe; for example, producing a new class that inherits from this but does not redefine the initialisation would clearly brake the game.
The reason for asking this is that I would like to include a method that saves the object to an HDF5 file, containing a section with the data (accessible to other uses or languages), and the serialised constructor as well, making it possible to reconstruct the object from the file.
R6::R6Class(..)call, right?