Skip to content

Export generics #2528

@hadley

Description

@hadley

From Kurt Hornik:


You may have seen that from R 3.5.0 onwards searching for S3 methods
uses the registry after hitting topenv and before the search path, and
there is also a way of not using the search path at all, which can be
achieved by setting R_S3_METHOD_LOOKUP_BASEENV_AFTER_GLOBALENV_=true in
the environment. The Debian regular checks are currently performed with
this setting.

This shows S3 method lookup problems in about 250 CRAN packages, mostly
simply due to packages failing to register S3 methods when they could
and should. However, there are also cases when this is not possible:
R-exts says in "Registering S3 methods",

To ensure that these methods are available the packages defining the
methods should ensure that the generics are imported and register the
methods using 'S3method' directives.

which of course needs that the generics are exported.

Now, apparently several packages see the need to provide S3 methods for
the generics

guide_train
scale_type

which ggplot2 provides but does not export: my current list is

colorplaner/NAMESPACE:export(guide_train.colorplane)
ggraph/NAMESPACE:export(guide_train.edge_colourbar)
ggraph/NAMESPACE:export(guide_train.edge_direction)
phylopath/NAMESPACE:export(guide_train.edge_colourbar)

ggforce/NAMESPACE:export(scale_type.units)
ggmosaic/NAMESPACE:export(scale_type.product)
ggmosaic/NAMESPACE:export(scale_type.productlist)
ggraph/NAMESPACE:export(scale_type.geometry)

Would it be possible for ggplot2 to export these generics, so that the
above exports could be turned into proper S3 method registrations?

Metadata

Metadata

Assignees

No one assigned

    Labels

    featurea feature request or enhancement

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions