On Saturday, March 13, 2021 at 5:01:46 PM UTC-8 Michael Orlitzky wrote:
> This is okay. The symbol object still exists even though you've
> clobbered the name that refers to it. Having "foo" in SR.symbols allows
> you to retrieve the underlying symbol object again (keeping its domain
> intact, for example) with foo = SR.symbol("foo"). You don't need to use
> the variable name "foo" to point to the "foo" symbol object, of course.
> If you ever start to feel that programming in sage is too easy, try
> defining x = SR.symbol("y") and y = SR.symbol("x").
>
> I say this is "okay" because that's how it's intended to work. Maybe on
> average that prevents us from garbage collecting a bunch of names for
> symbol objects that will never be referenced again. Who knows.
>
> I don't think the "symbols" list would be the only reference that prevents
symbols from being garbage collected. Once a symbol has been translated to
another system (through an "expect" or a library interface), a dictionary
for back-and-forth translation is maintained. Since this tends to straddle
*two* memory managers, it tends to be very hard to determine when an object
there is ready for collection, so this tends to not happen. I also don't
know if pynac/ginac even supports symbol memory deallocation. So having an
immortal symbols list on SR may also just be a record of what is happening
in reality anyway. If data structures describing a symbol are never going
to be deleted anyway, it's probably better to maintain a link to them.
--
You received this message because you are subscribed to the Google Groups
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/sage-devel/9e8b2906-d4a0-4d81-b58d-f19972ebc6d3n%40googlegroups.com.