On Sunday, 27 November 2016 at 22:25:51 UTC, John Colvin wrote:
On Saturday, 26 November 2016 at 17:37:57 UTC, Paolo Invernizzi wrote:
This is stated in documentation [1]:

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

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

But results to:

Error: non-constant expression ["foo":5L, "bar":10L, "baz":2000L]

Known bug?
If yes, Is there the need to emend the documentation, till the bug is open?
---
/Paolo

Known bug.

If you need a workaround, initialising the variable at load-time with `static this` should help in some cases.

Thank Joan,

The point is that I was trying to avoid some cycle between modules, detected by 2.072. This bug leads to pollution in the use of static this only to workaround the limitation...

--
Paolo

Reply via email to