Re: TIL: statically initializing an Associative Array

2024-05-06 Thread Andy Valencia via Digitalmars-d-learn
On Tuesday, 7 May 2024 at 01:14:24 UTC, Steven Schveighoffer wrote: On Tuesday, 7 May 2024 at 00:10:27 UTC, Andy Valencia wrote: I had a set of default error messages to go with error code numbers, and did something along the lines of: string[uint] error_text = [ 400: "A message",

Re: TIL: statically initializing an Associative Array

2024-05-06 Thread Steven Schveighoffer via Digitalmars-d-learn
On Tuesday, 7 May 2024 at 00:10:27 UTC, Andy Valencia wrote: I had a set of default error messages to go with error code numbers, and did something along the lines of: string[uint] error_text = [ 400: "A message", 401: "A different message" ]; and got "expression is not a

Re: TIL: statically initializing an Associative Array

2024-05-06 Thread matheus via Digitalmars-d-learn
On Tuesday, 7 May 2024 at 01:02:04 UTC, matheus wrote: On Tuesday, 7 May 2024 at 00:10:27 UTC, Andy Valencia wrote: ... Based on what I understood and that issue, I think it was fixed: ... By the way it works as immutable too. Matheus.

Re: TIL: statically initializing an Associative Array

2024-05-06 Thread matheus via Digitalmars-d-learn
On Tuesday, 7 May 2024 at 00:10:27 UTC, Andy Valencia wrote: I had a set of default error messages to go with error code numbers, and did something along the lines of: string[uint] error_text = [ 400: "A message", 401: "A different message" ]; and got "expression is not a

TIL: statically initializing an Associative Array

2024-05-06 Thread Andy Valencia via Digitalmars-d-learn
I had a set of default error messages to go with error code numbers, and did something along the lines of: string[uint] error_text = [ 400: "A message", 401: "A different message" ]; and got "expression is not a constant" I eventually found this discussion: