[Rd] Declaring Types at Function Declaration
Gabor Grothendieck
ggrothend|eck @end|ng |rom gm@||@com
Thu Nov 27 18:06:49 CET 2025
Of course R does have comments:
f <- function( a, # character
b, # data.frame
c # logical
) {
...
}
On Wed, Sep 17, 2025 at 1:26 PM 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
--
Statistics & Software Consulting
GKX Group, GKX Associates Inc.
tel: 1-877-GKX-GROUP
email: ggrothendieck at gmail.com
More information about the R-devel
mailing list