network
network copied to clipboard
Replace .validLHS() with tryCatch()?
The ultimate test of whether something can be assigned to is to actually try assigning to it.
It may therefore make sense to replace the
if(.validLHS(xn,parent.frame())){ #If x not anonymous, set in calling env
on.exit(eval.parent(call('<-', xn, x)))
}
invisible(x)
pattern with the much simpler
on.exit(try(eval.parent(call('<-', xn, x)), silent = TRUE))
invisible(x)
or, since we don't care about the try-error
object,
on.exit(tryCatch(eval.parent(call('<-', xn, x)), error = function(e){}))
invisible(x)
Thoughts? @CarterButts ?