Consider the following class (i.e., with intentionally confusing member names):
SomeClass <- R6::R6Class("SomeClass",
private = list(
.a = NULL,
.c = NULL
),
public = list(
e = NULL,
initialize = function() {
# ...
},
b = function() {
# ...
},
f = function() {
# ...
}
),
active = list(
g = function() {
# ...
},
d = function() {
# ...
}
)
)
Printing the generator yields:
<SomeClass> object generator
Public:
e: NULL
initialize: function ()
b: function ()
f: function ()
clone: function (deep = FALSE)
Active bindings:
g: function ()
d: function ()
Private:
.a: NULL
.c: NULL
Parent env: <environment: R_GlobalEnv>
Locked objects: TRUE
Locked class: FALSE
Portable: TRUE
Similarly, printing an instance yields:
<SomeClass>
Public:
b: function ()
clone: function (deep = FALSE)
d: active binding
e: NULL
f: function ()
g: active binding
initialize: function ()
Private:
.a: NULL
.c: NULL
It appears that the members under each access modifier are sorted alphabetically. Would it make sense for the default print method for instances to include an Active bindings section, similar to the object generator? I think this could improve clarity, especially for more complex classes and inheritance chains.
Consider the following class (i.e., with intentionally confusing member names):
Printing the generator yields:
<SomeClass> object generator Public: e: NULL initialize: function () b: function () f: function () clone: function (deep = FALSE) Active bindings: g: function () d: function () Private: .a: NULL .c: NULL Parent env: <environment: R_GlobalEnv> Locked objects: TRUE Locked class: FALSE Portable: TRUESimilarly, printing an instance yields:
<SomeClass> Public: b: function () clone: function (deep = FALSE) d: active binding e: NULL f: function () g: active binding initialize: function () Private: .a: NULL .c: NULLIt appears that the members under each access modifier are sorted alphabetically. Would it make sense for the default
printmethod for instances to include anActive bindingssection, similar to the object generator? I think this could improve clarity, especially for more complex classes and inheritance chains.