R6Class - Encapsulation issue: Bad design?
问题 Minimal example Attaching R6 package require(R6) Element class definition element_factory <- R6Class( "Element", private = list( ..value = 0), active = list( value = function(new) { if(missing(new)) private$..value else private$..value <- new})) Container class definition container_factory <- R6Class( "Container", private = list( ..element = element_factory$new() ), active = list( element = function() private$..element)) Creating container istance co <- container_factory$new() Accessing