sub-.fun.link: Generates object

[.fun.linkR Documentation

Description

... arguments are forwarded to the function corresponding to this fun.link unchanged. For that, the sys.call() expression is modified by removing x first argument and by changing the function name to generate of fun.club class (which will in turn forward ... to the corresponding function), and then evaluated.

There is a special case when the function corresponding to the fun.link also has an x argument. Then, x=something given in ... overwrites x (originally bounded to the fun.link object). The code below recovers it, however, as it is still saved as a first argument in the expression returned by sys.call(). (Eg. for a[x=1] or, equivalently, ⁠[.fun.link⁠('a', x=1) sys.call() returns arguments ⁠('a', x=1)⁠, and 'a' can be recovered). So, the function object can use arbitrary names without restrictions.

Note also, the fun.club functions in link.methods, like generate below, receive only ... as arguments. This is done on purpose. Eg. suppose that generate additionally receives the function object name and the link number, like in ⁠generate <- function(..., fo, i.link)⁠. In this case, if by chance the function object uses the same argument name fo or i.link, and one calls eg. link[a=1, b=2, fo=3], then this argument fo = 3 will be in conflict with the argument for the function object name. To avoid that, all functions receiving arguments through ..., ie. link.methods and also arg.list(...), do not receive anything else except ..., while the function object and the link number are propagated externally via link.methods[['fun.object']] and link.methods[['i.link']].

Usage

## S3 method for class 'fun.link'
x[...]

Author(s)

Vladislav BALAGURA balagura@cern.ch


balagura/fun.club documentation built on June 11, 2025, 11:27 p.m.