Reputation: 22820
OK, so this is the concept :
I'm currently writing a fairly complex project, consisting of 10's of different modules and classes.
I need to have one basic set of variables/options (an associative array?) which will be shared (read/write) by all modules (or selected ones) at any time.
What would be the most D-friendly way to achieve this?
UPDATE:
Hmm... just created a variable definition in one module (let's say globals.d
module) and no matter where I import it, I can always get/set it. That simple?! (Or am I missing anything?)
Upvotes: 1
Views: 240
Reputation: 25605
Just filling this in so there's an answer: yes, you generally would want to make a new module like globals.d and simply import it from all the other modules that use it.
Upvotes: 1