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

Support for R6 classes in otype() and ftype() #52

Open
fangly opened this issue Oct 25, 2016 · 0 comments
Open

Support for R6 classes in otype() and ftype() #52

fangly opened this issue Oct 25, 2016 · 0 comments

Comments

@fangly
Copy link

fangly commented Oct 25, 2016

Hi Hadley,

I am surprised that otype() and ftype() do not detect and report when the argument is an R6 object/method... yet. It would be great to have them support R6 in the future.

library(R6)
Person <- R6Class("Person",
  public = list(
    name = NULL,
    hair = NULL,
    initialize = function(name = NA, hair = NA) {
      self$name <- name
      self$hair <- hair
      self$greet()
    },
    set_hair = function(val) {
      self$hair <- val
    },
    greet = function() {
      cat(paste0("Hello, my name is ", self$name, ".\n"))
    }
  )
)
ann <- Person$new("Ann", "black")
otype(ann)

This example should return "R6", not "S3".

Cheers,
Florent

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

1 participant