r-lib / R6

Encapsulated object-oriented programming for R
https://R6.r-lib.org
Other
405 stars 56 forks source link

Use sentinel function for active bindings #130

Open hadley opened 6 years ago

hadley commented 6 years ago
public = list(
  blah = active_binding(function(value) {

  })
)

And eventually deprecate the active_bindings argument

idavydov commented 4 years ago

Maybe active_binding could have a read_only flag?

public = list(
  blah = active_binding(function() {

  }, read_only=TRUE)
)

And then there could be nice error-handling by default (similar to the goal of #100 and #99).

x$blah <- 0
# Error: blah is read-only