Hi,

I'm writing this global Config class, with an AA member:

```d
module my.config;

class Config
{
    Command[string] commands;
}

__gshared Config CONFIG;
```

and initialize it in another module:

```d
module my.app;

import my.config;

void main()
{
  CONFIG = new Config();
  CONFIG.commands["bye"] = new Command(...); // add commands
}
```

This is OK. But when I use a local variable to hold the commands AA:

```
auto cmds = CONFIG.commands;
cmds["list"] = new Command(...);
```

The command "list" is not added.

I guess what happened here was that `cmds` is a threadlocal variable, so the compiler somehow copied the CONFIG.commands.

My questions are:

1. Are AAs reference type? if so, why does the compiler copy it?
2. How do I reference a member of __gshared global objects?

Reply via email to