Depends on what exactly you're trying to achieve. I don't know the semantics of your variable, but I assume it's somehow "bound" to one of the modules, so let's say it's semantically bound to module A.
Then, the best way would be to make it local to module A and introduce a public interface for other modules to use that provides "valid" operations on the variable. B would call these functions instead of accessing the variable directly. This way, it's also clear which module depends on the other (B on A).
|