Skip to content
Prev 63079 / 63421 Next

Suggestion: default print method for S3 generics could offer some insights on '...' among registered methods

I don't really understand the premise.  Any function F with '...' as a formal
argument can pass '...' to another function G.  The actual arguments matching
'...' in the call to F will be matched to the formal arguments of G.  So the
the maintainer of F may want to alert the user of F to the existence of G and
the user of F may want to consult the documentation of G.

Whether F is S3 generic and G is registered as a method for F seems irrelevant.

That is a conceptual issue.  There are practical issues, too:

     * print.default is used "everywhere".  Backwards incompatible changes to
       default behaviour have the potential to break a lot of code out there.

     * Testing that a function F is S3 generic seems nontrivial.  You have to
       deal with internally generic functions and for closures recurse through
       body(F) looking for a call to UseMethod.

     * I would not want the output of print(F) to depend on details external to
       F or the method call, such as the state of the table of registered S3
       methods which changes as packages are loaded.  AFAIK, it is intended that
       options() is the only exception to the rule.

     * More harmonious would be to implement the feature ("give me more
       information about S3 methods") as an option (disabled by default) of
       utils::.S3methods if not as a new function altogether.

Mikael