[IGN-5244]Persist Python Class Object

Phil will correct me if I'm wrong, but a dataset (that itself contains only primitive type classes) is fine.

Consider setdefault.

4 Likes

Not wrong. To elaborate: classes that are defined by the platform are safe to place in a persistent dictionary, in any desired hierarchy. I highly recommend the java classes under java.util.concurrent for this kind of shared access. If you strictly control module reloading/restarting, you can often get away with including module-provided classes.

Yes, that is the race-free way to establish an initial value in a dictionary when multiple project contexts might be accessing it simultaneously.

2 Likes

Progress on this and related topics, via the new BindableVarMap objects now available in my Simulation Aids module:

JVM persistent objects are available with globalVarMap(), similar to but distinct from system.util.getGlobals(), available in in both scripting and expression bindings. Scripts can notify corresponding bindings via a .refresh() method.

Perspective session, page, and view associated maps are available in both scripts and expressions as for global variable maps, but these maps are weakly linked and are automatically discarded when the association is broken. As yes, expression refresh notifications also work with these.

2 Likes