Enhance Rcpp::Nullable::as with explicit cast (Closes #1470)#1471
Enhance Rcpp::Nullable::as with explicit cast (Closes #1470)#1471eddelbuettel wants to merge 1 commit intomasterfrom
Conversation
Enchufa2
left a comment
There was a problem hiding this comment.
Fine, although Nullable could be further improved. Having an as() method in the first place seems odd, because it deviates from the rest of the API. I.e., objects typically have T() and SEXP() operators. This one has the latter, and it would be nice to have the former for consistency instead of, or at least on top of, as(). Also typically set() and get() are private. See e.g. AttributeProxy, just to name something recent.
|
TBH I had forgotten these had and I just realize I still need to rename |
As discussed in #1470 and building on this morning's discussion at the bottom of #1451, we can make
Nullable<T>a little nicer. And that is all this PR does: for cases where the implicitas<>()needs a nudge, we can hide the nudge inside that (member function)as()function body accessing the matchingas<>for the given T. A little bit of ellbow grease.Checklist
R CMD checkstill passes all tests