-
Notifications
You must be signed in to change notification settings - Fork 41
Open
Description
This would make the S7 objects simpler, pointing only to named environment. My understanding is that a user fetching values from parent environments through lexical scoping would almost always be a mistake. An aspect I really like about S7 is that everything is contained in the object itself, the current enclosure system undermines this.
IIRC in R6 the enclosure is updated.
base classes currently use the enclosure could be adapted. For instance we can have :
class_logical <- list(
class = "logical",
constructor_name = "logical",
constructor = (function(.data = logical(0)) {
.data
}) |>
(`environment<-`)(baseenv()),
validator = (function(object) {
if (base_class(object) != "logical") {
sprintf("Underlying data must be <logical> not <%s>", base_class(object))
}
}) |>
(`environment<-`)(baseenv())
) |>
structure(class = "S7_base_class")
Right now there is no code class_logical
and friends are "different" in every session.
they could be enclosed in topenv()
too if we want to be able to use helpers in the NAMESPACE.
Metadata
Metadata
Assignees
Labels
No labels