-
Notifications
You must be signed in to change notification settings - Fork 59
Open
Description
Would there be any interest in adding dataclasses as a feature, similar to Python's ?
I find that it would help with avoiding initialize boilerplate for the cases where we just want a structured data container.
Currently:
Foo <- R6::R6Class(
"Foo",
public = list(
x = NULL,
y = NULL,
z = NULL,
initialize = function(x, y, z) {
self$x <- x
self$y <- y
self$z <- z
}
)
)
foo <- Foo$new(1, 2, 3)Hopefully:
Foo <- R6::R6DataClass(
"Foo",
public = list(
x = NULL,
y = NULL,
z = NULL,
)
)
foo <- Foo$new(1, 2, 3)Edit: or possibly just make initialize optional, with a default created for the user that handles their public fields ?
TomHall2020
Metadata
Metadata
Assignees
Labels
No labels