[Rd] Should invisible() get signature x=NULL?

Duncan Murdoch murdoch@dunc@n @end|ng |rom gm@||@com
Tue Aug 2 02:08:53 CEST 2022

On 01/08/2022 6:27 p.m., Michael Chirico via R-devel wrote:
> I think most experienced R users are familiar with return(invisible())
> being used as shorthand for return(invisible(NULL)).

I'm not sure that's true... the R sources themselves are inconsistent 
about using invisible() vs invisible(NULL).

> However, this NULL default is not documented anywhere -- we have to
> dive into src/main/print.c:do_invisible to source this behavior.
> Is this lack of documentation intentional? Otherwise, should the
> signature be updated to reflect this default?
> invisible <- function(x = NULL) .Primitive("invisible")
> Otherwise, should this default be mentioned in ?invisible ?

But documenting it seems wise.

Duncan Murdoch

More information about the R-devel mailing list