[Rd] exists, get and get0 accept silently inputs of length > 1

Antoine Fabri @nto|ne@|@br| @end|ng |rom gm@||@com
Fri Nov 13 15:15:37 CET 2020


Dear R-devel,

The doc of exists, get and get0 is unambiguous, x should be an object given
as a character string. However these accept longer inputs. It can lead an
uncareful user to think these functions are vectorized when they're not,
and generally lets through bugs that one might have preferred to trigger
earlier failure.

``` r
exists("d")
#> [1] FALSE
exists(c("c", "d"))
#> [1] TRUE
get(c("c", "d"))
#> function (...)  .Primitive("c")
get0(c("c", "d"))
#> function (...)  .Primitive("c")
```

I believe these should either fail, or be vectorized, probably the former.

Thanks,

Antoine

	[[alternative HTML version deleted]]



More information about the R-devel mailing list