Skip to content
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

typeof() and isS4() are inconsistent #151

Closed
hadley opened this issue Feb 8, 2022 · 4 comments
Closed

typeof() and isS4() are inconsistent #151

hadley opened this issue Feb 8, 2022 · 4 comments

Comments

@hadley
Copy link
Member

hadley commented Feb 8, 2022

library(R7)

foo <- new_class("Foo")()
isS4(foo)
#> [1] FALSE
typeof(foo)
#> [1] "S4"

Created on 2022-02-08 by the reprex package (v2.0.1)

@hadley hadley changed the title typeOf() and isS4() are inconsistent typeof() and isS4() are inconsistent Feb 8, 2022
@hadley
Copy link
Member Author

hadley commented Feb 8, 2022

@ltierney currently we create the "base" R7 object with:

SEXP R7_object_() {
  return Rf_allocSExp(S4SXP);
}

Should we be doing something different here?

Or does this inconsistency not matter?

@hadley
Copy link
Member Author

hadley commented Feb 8, 2022

Or is this correct? typeof(x) == "S4" implies that we're using the S4 object type while isS4(x) == FALSE implies that we're not using the S4 object system.

@lawremi
Copy link
Collaborator

lawremi commented Feb 11, 2022

Seems consistent to me. isS4() checks the object bit, which we are not setting.

@hadley
Copy link
Member Author

hadley commented Feb 11, 2022

Ok, great.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants