That’s not true. All ALLOCATIONS have a lifetime. That allocation may or may not have anthing to do with the object. It might not happen at the same time the object is created in the code (it may not even happen) and may or may not end at the same time as the object. This is especially true for immutables and could also be true for mutables.
Pass the object using Any
or a correct Ref
argument type directly. You almost never want to call pointer_to_objref
yourself. (If you are calling it, you are likely doing it wrong for mutable types as well)
Depending on what you mean here.
Ptr
isnt mutable andRef
is an abstract type (neither mutable or immutable).- If you mean that adding finalizer to a field of an object for tracking the lifetime of the parent object, then it won’t work. If you make sure that the thing you finalize is limited to that mutable field though it’ll of course work.