repr()
creates a call
object representing obj
, if possible.
Evaluating the call should come close to recreating the original object.
In the most trivial cases, it should be possible to recreate objects from their
representation by evaluating them using eval()
. Important exceptions
are:
Functions are represented by their source code, if available, and by their AST if not. This drops the context from their environments and recreated objects will not work if they contain functions that depend on specific environments
environment
s are not represented.
R6
objects are only represented if they have a $repr()
function.
This function may have arbitrary arguments, and should have a ...
argument to
capture ignored arguments.
Objects that can not be represented are currently mapped to the call stop("<###>")
, where
###
is a short description of the non-representable object.
repr(obj, ...)
(any)
Object to create a representation of.
(any)
Further arguments to be passed to class methods. Currently in use are:
call
: A call that, when evaluated, tries to re-create the object.