-
Notifications
You must be signed in to change notification settings - Fork 38
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
inheritance + check functions #193
Comments
Other ideas
|
Ensure that vector of |
Would |
What do you mean by a vector of |
You could use foo <- new_class("foo")
x <- foo()
is_a(x, foo)
#> [1] TRUE
is_a(1, foo)
#> [1] FALSE The library(R7)
foo <- new_class("foo", properties = list(x = character))
foo(x = NA)
#> Error: <foo> object properties are invalid:
#> - @x must be <character>, not <logical> Created on 2022-03-10 by the reprex package (v2.0.1) which I think is a bit unappealing. Maybe that needs to be handled elsewhere, but property type checking currently uses the internal |
Ok, so I'd prefer to handle the |
Need equivalent of
is()
/inherits()
, along with a helper that asserts that an object is of a class (extracting code out of the property checkers). Implementation already exists inclass_inherits()
; just needs a better name.The text was updated successfully, but these errors were encountered: