[Rcpp-devel] coercion NULL to vector

Serguei Sokol serguei.sokol at gmail.com
Wed Apr 18 17:53:02 CEST 2018

Le 18/04/2018 à 17:31, Jeff Newmiller a écrit :
> as.numeric( NULL ) is not silent, it is very explicit.
Well, written in this way yes. But I was referring more to the content 
than to the form. If you write as.numeric(x) and at some run-time point 
x become NULL, the code won't stop with an error. It will silently 
coerce NULL to numeric(0). Analogously in what I propose, if you write 
f(vec x) and at some call x is NULL, f would continue to work as if 
called with f(numeric(0)).

> Re this not being a C++ NULL, I don't object to R NULL being used that way (in fact it may be more sensible to do this than not, but it is not clear that R core thinks this way).
No sure to get your point here but never mind.


More information about the Rcpp-devel mailing list