Readonly
currentThe currently active environment (the stack is represented by the currently active IEnvironment#parent). Environments are maintained within the dataflow graph.
Readonly
levelnesting level of the environment, will be 0
for the global/root environment
An environment describes a (scoped) mapping of names to their definitions (EnvironmentMemory).
First, yes, R stores its environments differently, potentially even with another differentiation between the
baseenv
, theemptyenv
, and other default environments (see https://adv-r.hadley.nz/environments.html). Yet, during the dataflow analysis, we want sometimes to know more (static reference information) and sometimes know less (to be honest, we do not want that, but statically determining all attached environments is theoretically impossible --- consider attachments by user input).One important environment is the BuiltInEnvironment which contains the default definitions for R's built-in functions and constants. Please use initializeCleanEnvironments to initialize the environments (which includes the built-ins). During serialization, you may want to rely on the builtInEnvJsonReplacer to avoid the huge built-in environment.
See