Re: [Rcpp-devel] coercion NULL to vector

2018-04-18 Thread Serguei Sokol
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.

Re: [Rcpp-devel] coercion NULL to vector

2018-04-18 Thread Jeff Newmiller
as.numeric( NULL ) is not silent, it is very explicit. 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). On April 18, 2018 9:53:12 AM CDT, Serguei Sokol wrote: >Le

Re: [Rcpp-devel] coercion NULL to vector

2018-04-18 Thread Serguei Sokol
Le 18/04/2018 à 16:15, Jeff Newmiller a écrit : Regarding: "Actually, when NULL is provided to where a vector or a matrix is expected just an error is thrown. So we can hardly imagine that someone would have his program broken or will be misled if such coercion is introduced." If all programs

Re: [Rcpp-devel] coercion NULL to vector

2018-04-18 Thread Serguei Sokol
Le 18/04/2018 à 15:59, Dirk Eddelbuettel a écrit : Could you use XPtr ? Probably yes, as I could use Nullable<> too. But at what price? For me, the code would become far less readable. Serguei. ___ Rcpp-devel mailing list Rcpp-devel@lists.r-forge.r-p

Re: [Rcpp-devel] coercion NULL to vector

2018-04-18 Thread Jeff Newmiller
Regarding: "Actually, when NULL is provided to where a vector or a matrix is expected just an error is thrown. So we can hardly imagine that someone would have his program broken or will be misled if such coercion is introduced." If all programs were perfect this would be true, but the ability

Re: [Rcpp-devel] coercion NULL to vector

2018-04-18 Thread Dirk Eddelbuettel
Serguei, (Extra line breaks help readibility on text only mail readers) On 18 April 2018 at 14:51, Serguei Sokol wrote: | Le 18/04/2018 à 12:26, Georgi Boshnakov a écrit : | > I may be missing something here but | > it doesn't seem right to introduce silent coercion of NULL to vectors, etc., | >

Re: [Rcpp-devel] coercion NULL to vector

2018-04-18 Thread Serguei Sokol
Le 18/04/2018 à 13:32, Dirk Eddelbuettel a écrit : On 18 April 2018 at 10:26, Georgi Boshnakov wrote: | I may be missing something here but | it doesn't seem right to introduce silent coercion of NULL to vectors, etc., | especially if it would become imposed on everybody using Rcpp/Armadillo. |

Re: [Rcpp-devel] coercion NULL to vector

2018-04-18 Thread Serguei Sokol
018 10:57 To: Dirk Eddelbuettel Cc: Rcpp-devel Subject: Re: [Rcpp-devel] coercion NULL to vector Le 17/04/2018 à 17:53, Dirk Eddelbuettel a écrit : On 17 April 2018 at 10:31, Dirk Eddelbuettel wrote: | | On 17 April 2018 at 15:09, Serguei Sokol wrote: ... | | It will automatically coerce NULL to

Re: [Rcpp-devel] coercion NULL to vector

2018-04-18 Thread Dirk Eddelbuettel
On 18 April 2018 at 10:26, Georgi Boshnakov wrote: | I may be missing something here but | it doesn't seem right to introduce silent coercion of NULL to vectors, etc., | especially if it would become imposed on everybody using Rcpp/Armadillo. | Even the "convenience" of this is questionable.

Re: [Rcpp-devel] coercion NULL to vector

2018-04-18 Thread Georgi Boshnakov
From: rcpp-devel-boun...@lists.r-forge.r-project.org [mailto:rcpp-devel-boun...@lists.r-forge.r-project.org] On Behalf Of Serguei Sokol Sent: 18 April 2018 10:57 To: Dirk Eddelbuettel Cc: Rcpp-devel Subject: Re: [Rcpp-devel] coercion NULL to vector Le 17/04/2018 à 17:53, Dirk Eddelbuettel a

Re: [Rcpp-devel] coercion NULL to vector

2018-04-18 Thread Serguei Sokol
Le 17/04/2018 à 17:53, Dirk Eddelbuettel a écrit : On 17 April 2018 at 10:31, Dirk Eddelbuettel wrote: | | On 17 April 2018 at 15:09, Serguei Sokol wrote: ... | | It will automatically coerce NULL to a declared vector type. | | It's a more primitive solution than Nullable but in many cases | |

Re: [Rcpp-devel] coercion NULL to vector

2018-04-17 Thread Dirk Eddelbuettel
On 17 April 2018 at 10:31, Dirk Eddelbuettel wrote: | | On 17 April 2018 at 15:09, Serguei Sokol wrote: | | Hi, | | | | I would like to re-discuss the subject of automatic coercion of | | NULL to some vector in function parameter list. This old topic was | | already raised e.g. here | | https:/

Re: [Rcpp-devel] coercion NULL to vector

2018-04-17 Thread Dirk Eddelbuettel
On 17 April 2018 at 15:09, Serguei Sokol wrote: | Hi, | | I would like to re-discuss the subject of automatic coercion of | NULL to some vector in function parameter list. This old topic was | already raised e.g. here | https://stackoverflow.com/questions/34718570/rcpp-pass-vector-of-length-0-nu

[Rcpp-devel] coercion NULL to vector

2018-04-17 Thread Serguei Sokol
Hi, I would like to re-discuss the subject of automatic coercion of NULL to some vector in function parameter list. This old topic was already raised e.g. here https://stackoverflow.com/questions/34718570/rcpp-pass-vector-of-length-0-null-to-cppfunction To resume, actually a function defined as