Skip to content
Prev 61854 / 63424 Next

[External] Re: Calling a replacement function in a custom environment

Conceptually, the same is true for `a$b` when `a` is used as an
environment. In fact, for environments `$` logically acts as a scope
resolution operator in much the same way `::` does. This usage exists
notably for ?R6? classes and ?box? modules, and the fact that replacement
functions cannot be called in such scenarios is a confusing limitation for
users of these packages.

In fact, if the aim of allowing replacement function calls for `a::b` is to
reduce confusion, the same argument applies to `a$b` (and users don?t
understand why the former works but the latter does not ? I?d even argue
that the current inconsistency *increases* rather than reduces confusion).
I generally agree with this, but the current behaviour is inconsistent,
confusing, and breaks seemingly-straightforward and actively useful code.

Cheers,
Konrad