AA literals/initialisation
Manu
turkeyman at gmail.com
Mon Nov 11 01:42:07 PST 2013
A work-around of that type required by a core language feature is not a
sign of quality...
It get's me every single time, and I forget and have to go and find out why
again each time.
Please, fix it finally.
On 11 November 2013 18:33, simendsjo <simendsjo at gmail.com> wrote:
> On Monday, 11 November 2013 at 08:30:32 UTC, Manu wrote:
>
>> immutable string[string] priorityMap = [
>> "1" : "blocker",
>> "2" : "critical",
>> "3" : "critical",
>> "4" : "major",
>> "5" : "major",
>> "6" : "major",
>> "7" : "minor",
>> "8" : "minor",
>> "9" : "trivial" ];
>>
>> main.d(56): Error: non-constant expression ["1":"blocker", "2":"critical",
>> "3":"critical", "4":"major", "5":"major", "6":"major", "7":"minor",
>> "8":"minor", "9":"trivial"]
>>
>> This is tedious, how long has it been now?
>> Seriously, static map's are super-important, they should be able to be
>> made
>> immutable, and also be able to be initialised.
>>
>> Maybe this could be factored into the improvements for 2.065?
>>
>
> The workaround is simple at global scope, but I agree it clutters the code:
>
> immutable string[string] priorityMap;
> shared static this() {
>
> priorityMap = [
> "1" : "blocker",
> "2" : "critical",
> "3" : "critical",
> "4" : "major",
> "5" : "major",
> "6" : "major",
> "7" : "minor",
> "8" : "minor",
> "9" : "trivial" ];
> }
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20131111/b55f8663/attachment.html>
More information about the Digitalmars-d
mailing list