[Rd] Declaring Types at Function Declaration

Hadley Wickham h@w|ckh@m @end|ng |rom gm@||@com
Wed Nov 26 17:50:34 CET 2025


You might be interested in Jim Hester’s old experiment that used ? -
https://github.com/jimhester/types

Hadley

On Wednesday, September 17, 2025, IVO I WELCH <iwelch using g.ucla.edu> wrote:

>
> 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
>
> ______________________________________________
> R-devel using r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
>


-- 
http://hadley.nz

	[[alternative HTML version deleted]]



More information about the R-devel mailing list