On Thursday, 11 December 2014 at 21:35:43 UTC, H. S. Teoh via Digitalmars-d-learn wrote:
On Thu, Dec 11, 2014 at 08:56:00PM +0000, Paul via Digitalmars-d-learn wrote:
Is there any merit (or folly!) in storing a large array, that
frequently needs to be accessed globally, within a class like so:

public class classMap{
        
        public static int[MAPSIZE][MAPSIZE] map;

}

Or is there a proper 'D' way to do this?
[...]

Why do you need to wrap it inside a class? Why not just put it in
module-global scope, since it's public anyway?


T

I guess I'm looking for the correct method to create a globally accessible bunch of data (basically the program state) with associated functions while trying to provide some measure of safety compared to ordinary global variables. I suppose putting them in the same module with that array in the global namespace is no different.

Reply via email to