[Rd] Declaring Types at Function Declaration

IVO I WELCH |we|ch @end|ng |rom g@uc|@@edu
Wed Sep 17 19:23:53 CEST 2025


Suggestion for Syntax Sugar:

Would it make sense to permit a simple way to allow a coder to document the function argument type?

f <- function( a:chr, b:data.frame, c:logi ) { … }

presumably, what comes behind the ‘:’ should match what ‘str’ returns.

however, this need not be checked (except perhaps when a particular option is set).  catching errors as soon as possible makes code easier to debug and error messages clearer.

regards,

/iaw



More information about the R-devel mailing list