D - const for associative arrays?
- Steve Adams (4/4) Mar 12 2004 Is there a way to declare and initialize associative arrays? Something
- Walter (4/7) Mar 12 2004 Currently, there isn't. One way to do it is to use a module constructor ...
- C. Sauls (16/27) Mar 12 2004 When do you think that might become available? I'm really looking
- Walter (3/7) Mar 12 2004 Not for 1.0, but better array literals are a good candidate for 2.0.
- Steve Adams (2/15) Mar 12 2004 Thanks, I'll use that approach.
- Phill (5/9) Mar 12 2004 I think you will find that info here:
Is there a way to declare and initialize associative arrays? Something along the lines of: const int[char[]] foo = list of pairs? Thanks.
Mar 12 2004
"Steve Adams" <adamss ascinet.com> wrote in message news:40521D81.4030808 ascinet.com...Is there a way to declare and initialize associative arrays? Something along the lines of: const int[char[]] foo = list of pairs?Currently, there isn't. One way to do it is to use a module constructor to load up the array.
Mar 12 2004
When do you think that might become available? I'm really looking forward to it personally, because I have a lot of those module constructors doing just that, and it would be nice to get it all in one statement. I'm sure its all been said before, but I'm personally a fan of the : syntax... const int[char[]] FOO = [ "abc" : 1, "def" : 2, "ghi" : 3 ]; Feels consistant with the struct syntax, and reminds me of Python all at once. :) -C. Sauls -Invironz Walter wrote:"Steve Adams" <adamss ascinet.com> wrote in message news:40521D81.4030808 ascinet.com...Is there a way to declare and initialize associative arrays? Something along the lines of: const int[char[]] foo = list of pairs?Currently, there isn't. One way to do it is to use a module constructor to load up the array.
Mar 12 2004
"C. Sauls" <ibisbasenji yahoo.com> wrote in message news:c2tess$2mki$1 digitaldaemon.com...When do you think that might become available? I'm really looking forward to it personally, because I have a lot of those module constructors doing just that, and it would be nice to get it all in one statement.Not for 1.0, but better array literals are a good candidate for 2.0.
Mar 12 2004
Walter wrote:"Steve Adams" <adamss ascinet.com> wrote in message news:40521D81.4030808 ascinet.com...Thanks, I'll use that approach.Is there a way to declare and initialize associative arrays? Something along the lines of: const int[char[]] foo = list of pairs?Currently, there isn't. One way to do it is to use a module constructor to load up the array.
Mar 12 2004
I think you will find that info here: http://www.digitalmars.com/d/arrays.html Phill. "Steve Adams" <adamss ascinet.com> wrote in message news:40521D81.4030808 ascinet.com...Is there a way to declare and initialize associative arrays? Something along the lines of: const int[char[]] foo = list of pairs? Thanks.
Mar 12 2004