copy: Copy an RStatic Object

View source: R/copy.R

copyR Documentation

Copy an RStatic Object

Description

This function copies the given RStatic object, while ensuring that parent-child relationships are preserved for the copied object.

Usage

copy(x, ...)

Arguments

x

The object to copy.

...

Additional arguments to methods.

skip_set_parent

(character) Names of fields which should never have set_parent called on them.

Details

If x is any other R6 object, x is deep-cloned. If x is not an R6 object, no action is taken and x is returned.

Since RStatic objects are references, assignment does not make a copy. This function can be used to explicitly copy an RStatic object.

See Also

set_parent, which is used by this function.

Examples

x = quote_ast(x <- "Hi DTL!")
y = x
z = copy(x)

x$read = Numeric$new(141)

# Changing 'x' changed 'y' (a reference), but not 'z' (a copy).

nick-ulle/ast documentation built on May 14, 2024, 7:40 p.m.