yihui / xfun

Miscellaneous R functions
https://yihui.org/xfun/
Other
141 stars 28 forks source link

Should xfun_raw_string also inherit character? #40

Closed MichaelChirico closed 3 years ago

MichaelChirico commented 3 years ago
inherits(r <- xfun::raw_string("abcd"), "character")
# [1] FALSE
identical(as.character(r), unclass(r))
# [1] TRUE

I'm not super familiar with all use cases, but it seems xfun_raw_string class is all about its print method. Is there a reason it wouldn't also inherit from character so it can be passed to character methods?

yihui commented 3 years ago

I think it should. Please feel free to submit a PR. Thanks!