diff --git a/R/constructor.R b/R/constructor.R index 1319e4e6..c4c29ac2 100644 --- a/R/constructor.R +++ b/R/constructor.R @@ -48,7 +48,7 @@ constructor_args <- function(parent, properties = list()) { self_args <- names2(properties) # Remove dynamic arguments - self_args <- self_args[vlapply(properties, function(x) is.null(x$getter))] + self_args <- self_args[vlapply(properties, Negate(prop_is_read_only))] if (is_class(parent) && !parent@abstract) { # Remove any parent properties; can't use parent_args() since the constructor # might automatically set some properties. diff --git a/R/property.R b/R/property.R index c5a42ee5..c8c5cf3d 100644 --- a/R/property.R +++ b/R/property.R @@ -220,7 +220,7 @@ prop_obj <- function(object, name) { stop(prop_error_unknown(object, name), call. = FALSE) } - if (!is.null(prop$getter) && is.null(prop$setter)) { + if (prop_is_read_only(prop)) { msg <- sprintf("Can't set read-only property %s@%s", obj_desc(object), name) stop(msg, call. = FALSE) }