On Thursday, 11 March 2021 at 18:41:08 UTC, Ali Çehreli wrote:
On 3/11/21 10:06 AM, Chris Piker wrote:
>https://dlang.org/spec/hash-map.html#static_initialization
>
> that this feature is not yet implemented.
I use a shared static this() block:
immutable string[int] aa;
shared static this
On Thursday, 11 March 2021 at 19:12:34 UTC, H. S. Teoh wrote:
On Thu, Mar 11, 2021 at 06:06:35PM +, Chris Piker via
immutable int[string] aa;
shared static this() {
aa = [ "abc": 123, "def": 456, /* ... */ ];
}
Hi H.S.T
Yes, I'm using static if, but do you
On Thursday, 11 March 2021 at 18:41:08 UTC, Ali Çehreli wrote:
On 3/11/21 10:06 AM, Chris Piker wrote:
>https://dlang.org/spec/hash-map.html#static_initialization
>
> that this feature is not yet implemented.
I use a shared static this() block:
immutable string[int] aa;
shared static this
On Thu, Mar 11, 2021 at 06:06:35PM +, Chris Piker via Digitalmars-d-learn
wrote:
[...]
> Today I ran across a situation where an immutable associative array
> would be handy. While perusing the language spec I noticed here:
>
> https://dlang.org/spec/hash-map.html#static_initialization
>
>
On 3/11/21 10:06 AM, Chris Piker wrote:
>https://dlang.org/spec/hash-map.html#static_initialization
>
> that this feature is not yet implemented.
I use a shared static this() block:
immutable string[int] aa;
shared static this() {
aa = [ 1: "one" ];
}
void main() {
assert(aa.length ==
Hi D
At work I've begun writing programs in D that I would typically
write in python. My goal is to get away from split python/C
development and just use one language most of the time. Today I
ran across a situation where an immutable associative array would
be handy. While perusing the lan
What's the advantage of doing this? Having quicker startup times?
Syntax. Read the first post of this thread.
Daniel Keep:
> I think Walter said something a while back to the effect that making it
> possible to statically initialise AAs isn't feasible because it requires
> setting up a complex structure on the heap.
At the moment you can't statically initialize a built-in AA in D.
But with a small change
Tyro[a.c.edwards] wrote:
> Is it yet possible to statically initialize an associative array? If so,
> please point me to the documentation. I am using DMD v2.028.
>
> Currently I'm able to do this:
>
> import std.stdio;
>
> string[string] types;
> static this(){
> types = [ "void":"void",
may be you can raplace string with char[] ?
Is it yet possible to statically initialize an associative array? If so,
please point me to the documentation. I am using DMD v2.028.
Currently I'm able to do this:
import std.stdio;
string[string] types;
static this(){
types = [ "void":"void", "bool":"bool" ];
}
void main(){
writeln(
Is it yet possible to statically initialize an associative array? If so,
please point me to the documentation. I am using DMD v2.028.
Thanks,
Andrew
12 matches
Mail list logo