Member access of __gshared global object

via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Thu Jul 31 03:22:27 PDT 2014


On Thursday, 31 July 2014 at 02:03:37 UTC, Puming wrote:
> 1. Are AAs reference type? if so, why does the compiler copy it?

This is probably your problem. They are reference types, but 
initially that reference is `null`. When you write:

     auto cmds = CONFIG.commands;

`cmds` contains a copy of the `null` value. On assignment, the 
actual AA is created, and assigned to `cmds`, but not back to 
`CONFIG.commands`. Try initializing the AA in your class 
constructor.


More information about the Digitalmars-d-learn mailing list