Skip to content

Commit a9b478c

Browse files
dkorpeldlang-bot
authored andcommitted
Remove note about static initialization of AAs
1 parent 817effa commit a9b478c

File tree

1 file changed

+0
-28
lines changed

1 file changed

+0
-28
lines changed

spec/hash-map.dd

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -359,34 +359,6 @@ $(SPEC_RUNNABLE_EXAMPLE_RUN
359359

360360
$(P For details, see $(REF1 update, object).)
361361

362-
$(H2 $(LNAME2 static_initialization, Static Initialization of AAs))
363-
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.
368-
369-
---------
370-
// in global scope
371-
immutable long[string] aa = [
372-
"foo": 5,
373-
"bar": 10,
374-
"baz": 2000
375-
];
376-
377-
unittest
378-
{
379-
assert(aa["foo"] == 5);
380-
assert(aa["bar"] == 10);
381-
assert(aa["baz"] == 2000);
382-
}
383-
---------
384-
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-
390362
$(H2 $(LNAME2 runtime_initialization, Runtime Initialization of Immutable AAs))
391363

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

0 commit comments

Comments
 (0)