Doing some real hacky stuff.
I want to make an anonymous module with variables.
Kind of pseudocode, I want:
module ()
foo = 404
end
Where I’m at (in real code) is:
cur_anon = Module()
// this returns: anonymous
Doing some real hacky stuff.
I want to make an anonymous module with variables.
Kind of pseudocode, I want:
module ()
foo = 404
end
Where I’m at (in real code) is:
cur_anon = Module()
// this returns: anonymous
eval(cur_anon, :(....................))
Note that not everything will work in such a module (serialization etc) it shouldn’t segfault though if you are just defining variables and running “simple” code in it. It might also not be GC’d.
Playing devil’s advocate, what work would need to be done to get serialization and GC working?
Also, are there ways to manually add items to the GC stack?
GC will work. There will just be a lot of things cached referencing to it that keep it alive.
Unclear what do you mean or want.
Is this true for all modules?
I meant how do you go about forcing a clear/deregister/unassign (whatever the word is for deallocating disk space) towards an anon module
Yes.
FWIW, adding things to the GC stack preserves it. (And it was what you want to preserve that I was asking about). No you cannot lie to the GC.
Alright. Thanks for the info!
I was just seeing how far I could go with the idea