You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Alas some other R packages redefine print in a way that breaks ESS!!!
For example, d3heatmap redefines it thusly:
> print
nonstandardGenericFunction for "print" defined from package "d3heatmap"
function (gadget)
{
standardGeneric("print")
}
<bytecode: 0x1d2e5a80>
<environment: 0x1d2dc8a8>
Methods may be defined for arguments: gadget
Use showMethods(print) for currently available ones.
This arguably is a bad idea and has been reported, but, regardless, ESS can protect against this by consistently calling base::print
One very notable breakage that occurs is repeated annoying occurrences of
which happens when ess--idle-timer-function's call to ess-synchronize-dirs in turn calls (ess-get-words-from-vector ess-getwd-command) which uses an unprotected print resulting in nil be returned as the incorrect presumed value of (getwd) which gets passed along to ess--derive-connection-path.
A fix is to prefix base:: to all built calls to print, and possibly more generally, to across-the-board qualify built function calls with package names.
I drafted a more robust way of dealing with this in #1170 (comment)
I'm now thinking that if we're going to introduce a breaking change, we should go all the way and evaluate commands in a child of base env rather than in a child of the current env. This way we improve robustness as objects and functions defined by the user can't interfere with commands. But this means functions in other packages (utils in particular) must be namespaced with ::, which will cause trouble for a while as people update their commands.
Another option is to create a clone of the utils package env that inherits from base. I think that's be a reasonable choice for the command environment, basically a private namespace with an import(utils) setting. Each command would be evaluated in a child so they can create bindings without littering the namespace. With both base and utils functions in scope, the breakages to existing commands should be limited.
However we need to find a solution for the ESS commands that use .ess.foo() utils. Those are currently attached to the search path and won't be in scope in such a command namespace. I'll keep thinking about this before drawing up a proposal.
It's easy to forget the namespace qualifiers, and it may make the code harder to read, so evaluating in a namespace seems better overall.
ESS is inconsistent as to whether built function calls to R's
print
function are qualified by the package, e.g. asbase::print
. viz:Alas some other R packages redefine
print
in a way that breaks ESS!!!For example, d3heatmap redefines it thusly:
This arguably is a bad idea and has been reported, but, regardless, ESS can protect against this by consistently calling
base::print
One very notable breakage that occurs is repeated annoying occurrences of
which happens when
ess--idle-timer-function
's call toess-synchronize-dirs
in turn calls(ess-get-words-from-vector ess-getwd-command)
which uses an unprotectedprint
resulting innil
be returned as the incorrect presumed value of(getwd)
which gets passed along toess--derive-connection-path
.A fix is to prefix
base::
to all built calls toprint
, and possibly more generally, to across-the-board qualify built function calls with package names.This is possibly the root cause of #1180
The text was updated successfully, but these errors were encountered: