I generally don't use global state. However, when working with macros that are invoked in different modules, it can be convenient to use some form of global state in 1 module so that different modules can work with the same things (as opposed to passing around a structure or tuple). When I say global state, I would like it to be global at least to 1 module (I don't think it can be more global than that), it can be thread-local, it needs to be able to store arbitrary types of data.
So here's the question. If I maintain some sort of global state that has things of type
T, can I have portions of code that do the following things.
Basically, I need to be able to pass around references to them, and do stuff with them as if they were local variables in scope.
Is this possible?