I think the root of the issue here is the global genvar_registry. Is that really a good idea? It reminds me of old versions of JuMP that had macros like @variable x rather than @variable model x, where in the former case information would be stored in some opaque global variable. But that means you can’t have two completely independent models in the same session, and results in issues with thread safety. So I think that’s the origin of the code smell and the need for all these acrobatics in this case as well.
1 Like