893d9936ed
This commit refactors the `Environment` struct to better manage the Rust Runtime Library (RTL) bootstrap state. A new `Rtl` struct is introduced to hold a frozen snapshot of the initial RTL state, including scopes, types, purity, values, and documentation. This snapshot is created once after `rtl::register()` completes. The `Environment::new()` constructor is updated to perform a two-phase bootstrap: first, it registers RTL functions, and then it freezes the scope 0 and captures the RTL state into the new `Rtl` struct. A new constructor, `Environment::from_rtl()`, is added. This allows creating independent execution environments that all share the same underlying RTL state. This is crucial for isolation between different execution contexts, as user definitions and loaded modules will not leak between environments created from the same `Rtl` snapshot. The `Environment::list_bindings` and `Environment::list_rtl_docs` methods are updated to use the `rtl` field for accessing the RTL scope and documentation, reinforcing the concept of a shared, immutable RTL state. A new test, `test_environments_from_shared_rtl_are_independent`, is added to verify that environments created from the same `Rtl` snapshot are indeed independent and do not leak user-defined bindings.