I’m using D to crunch some data, it would be nice for me to be able to have an immutable map of maps that hold direction coordinates. I tried to do this via:
enum Direction
{
NORTH = "north",
SOUTH = "south"
}
immutable Direction[int][int] COORD_LOOKUP = [
3: [2: Direction.NORTH], 1: [3: Direction.SOUTH]
];
However ldc
fails with the following:
Error: not an associative array initializer
How can I create this associative array?
Seems like a bug, not LDC specific. https://github.com/dlang/dmd/issues/17804
Per that bug report, the parentheses seem to “work”, but causes another failure in static AA initialization.
1