On Thursday, 3 March 2016 at 10:35:50 UTC, MGW wrote:
The citation from https://dlang.org/spec/hash-map.html

Static Initialization of AAs
----------------------------

immutable long[string] aa = [
  "foo": 5,
  "bar": 10,
  "baz": 2000
];

unittest
{
    assert(aa["foo"] == 5);
    assert(aa["bar"] == 10);
    assert(aa["baz"] == 2000);
}

Judging by the text, it is static initialization, during compilation.

Hey your right! https://dlang.org/spec/hash-map.html

I don't actually understand D that much but runtime logic made sense...

That unit test passes somehow, perhaps because unit test are executed? Looks like a bug in the test and/or documentation!

Reply via email to