network icon indicating copy to clipboard operation
network copied to clipboard

Make network base class an environment?

Open krivit opened this issue 3 years ago • 0 comments

The current implementation of modifiers for network objects attempts to modify it in place, emulating behaviour of C++, Java, and Python classes, and R6 classes in R. This is accomplished by gabbing the expression for the network from the calling function and then assigning to it at the end if possible. This is quite kludgey, and may produce inconsistent or unpredictable behaviour, say, when a network object is passed to a function and modified there, or when a network is produced by an expression.

This may be possible to avoid using the same approach as R6 classes: whereas R lists are copied on modification, R environments are always references and need to be copied explicitly. Thus, if a network base class is an environment, changes to it will always change it in place automatically.

krivit avatar May 21 '22 03:05 krivit