Jump to page: 1 25  
Page
Thread overview
AA literals/initialisation
Nov 11, 2013
Manu
Nov 11, 2013
simendsjo
Nov 11, 2013
Manu
Nov 11, 2013
Daniel Kozak
Nov 11, 2013
Daniel Kozak
Nov 11, 2013
Daniel Kozak
Nov 11, 2013
Daniel Kozak
Nov 11, 2013
Manu
Nov 11, 2013
Dmitry Olshansky
Nov 11, 2013
Daniel Kozak
Nov 11, 2013
simendsjo
Nov 11, 2013
Dmitry Olshansky
Nov 11, 2013
Jonathan M Davis
Nov 12, 2013
TheFlyingFiddle
Nov 12, 2013
Jonathan M Davis
Nov 11, 2013
OneTwo
Nov 11, 2013
Jonathan M Davis
Nov 11, 2013
Daniel Murphy
Nov 12, 2013
Don
Nov 12, 2013
Daniel Murphy
Jan 12, 2014
Manu
Jan 12, 2014
Orvid King
Jan 12, 2014
Manu
Jan 12, 2014
Manu
Jan 12, 2014
Jakob Ovrum
Jan 12, 2014
Manu
Jan 12, 2014
Jakob Ovrum
Jan 12, 2014
Daniel Murphy
Jan 12, 2014
Jakob Ovrum
Jan 12, 2014
Daniel Murphy
Jan 12, 2014
Jakob Ovrum
Jan 12, 2014
Daniel Murphy
Jan 12, 2014
Daniel Murphy
Jan 12, 2014
Manu
Jan 12, 2014
Daniel Murphy
Jan 12, 2014
Daniel Murphy
Jan 12, 2014
Brad Anderson
Jan 12, 2014
Brad Anderson
Jan 13, 2014
Brad Anderson
November 11, 2013
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?


November 11, 2013
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" ];
  }
November 11, 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@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" ];
>   }
>


November 11, 2013
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?

this work ok for me:

immutable priorityMap = [
        "1" : "blocker",
        "2" : "critical",
        "3" : "critical",
        "4" : "major",
        "5" : "major",
        "6" : "major",
        "7" : "minor",
        "8" : "minor",
        "9" : "trivial" ];
November 11, 2013
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?

And even this works ok:

immutable string[string] priorityMap = [
"1" : "blocker",
"2" : "critical",
"3" : "critical",
"4" : "major",
"5" : "major",
"6" : "major",
"7" : "minor",
"8" : "minor",
"9" : "trivial" ];
November 11, 2013
On Monday, 11 November 2013 at 10:11:18 UTC, Daniel Kozak 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?
>
> And even this works ok:
>
> immutable string[string] priorityMap = [
> "1" : "blocker",
> "2" : "critical",
> "3" : "critical",
> "4" : "major",
> "5" : "major",
> "6" : "major",
> "7" : "minor",
> "8" : "minor",
> "9" : "trivial" ];

Ohh, but non works on module scope, so yes, it would be fine to fix this

November 11, 2013
On Monday, 11 November 2013 at 10:13:02 UTC, Daniel Kozak wrote:
> On Monday, 11 November 2013 at 10:11:18 UTC, Daniel Kozak 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?
>>
>> And even this works ok:
>>
>> immutable string[string] priorityMap = [
>> "1" : "blocker",
>> "2" : "critical",
>> "3" : "critical",
>> "4" : "major",
>> "5" : "major",
>> "6" : "major",
>> "7" : "minor",
>> "8" : "minor",
>> "9" : "trivial" ];
>
> Ohh, but non works on module scope, so yes, it would be fine to fix this

but enum works fine:

enum priorityMap = [
    "1" : "blocker",
    "2" : "critical",
    "3" : "critical",
    "4" : "major",
    "5" : "major",
    "6" : "major",
    "7" : "minor",
    "8" : "minor",
    "9" : "trivial" ];
November 11, 2013
On 11 November 2013 20:14, Daniel Kozak <kozzi11@gmail.com> wrote:

> On Monday, 11 November 2013 at 10:13:02 UTC, Daniel Kozak wrote:
>
>> On Monday, 11 November 2013 at 10:11:18 UTC, Daniel Kozak 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?
>>>>
>>>
>>> And even this works ok:
>>>
>>> immutable string[string] priorityMap = [
>>> "1" : "blocker",
>>> "2" : "critical",
>>> "3" : "critical",
>>> "4" : "major",
>>> "5" : "major",
>>> "6" : "major",
>>> "7" : "minor",
>>> "8" : "minor",
>>> "9" : "trivial" ];
>>>
>>
>> Ohh, but non works on module scope, so yes, it would be fine to fix this
>>
>
> but enum works fine:
>
> enum priorityMap = [
>
>     "1" : "blocker",
>     "2" : "critical",
>     "3" : "critical",
>     "4" : "major",
>     "5" : "major",
>     "6" : "major",
>     "7" : "minor",
>     "8" : "minor",
>     "9" : "trivial" ];
>

So it does... I didn't think of an enum AA ;)


November 11, 2013
"Manu" <turkeyman@gmail.com> wrote in message news:mailman.355.1384158631.9546.digitalmars-d@puremagic.com...
> 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?
>

I think yes, it can be done for 2.065.  Someone remind me if we get close and it isn't done yet.


November 11, 2013
11-Nov-2013 15:06, Manu пишет:

>     but enum works fine:
>
>     enum priorityMap = [
>
>          "1" : "blocker",
>          "2" : "critical",
>          "3" : "critical",
>          "4" : "major",
>          "5" : "major",
>          "6" : "major",
>          "7" : "minor",
>          "8" : "minor",
>          "9" : "trivial" ];
>
>
> So it does... I didn't think of an enum AA ;)

... copy pastes that literal everywhere, I'm sure you'll like it ;)

-- 
Dmitry Olshansky
« First   ‹ Prev
1 2 3 4 5