Skip to content

Commit 0789e99

Browse files
WebFreak001dlang-bot
authored andcommitted
make AA "Not yet implemented" note better
1 parent f65233d commit 0789e99

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

spec/hash-map.dd

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -361,9 +361,13 @@ $(SPEC_RUNNABLE_EXAMPLE_RUN
361361

362362
$(H2 $(LNAME2 static_initialization, Static Initialization of AAs))
363363

364-
NOTE: Not yet implemented.
364+
NOTE: Static initialization, e.g. assigning an AA value to a global or
365+
static variable, isn't implemented yet. AAs can be constructed and used
366+
at runtime and at compile time as usual. Pre-computed AA values embedded
367+
into the executable are however not yet possible.
365368

366369
---------
370+
// in global scope
367371
immutable long[string] aa = [
368372
"foo": 5,
369373
"bar": 10,
@@ -378,6 +382,11 @@ $(H2 $(LNAME2 static_initialization, Static Initialization of AAs))
378382
}
379383
---------
380384

385+
As a workaround you can use
386+
$(LINK2 spec/module.html#staticorder, static constructors) or
387+
$(LINK2 spec/pragma.html#crtctor, CRT constructors) to initialize global
388+
AAs immediately at program startup.
389+
381390
$(H2 $(LNAME2 runtime_initialization, Runtime Initialization of Immutable AAs))
382391

383392
$(P Immutable associative arrays are often desirable, but sometimes

0 commit comments

Comments
 (0)