File tree Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -361,9 +361,13 @@ $(SPEC_RUNNABLE_EXAMPLE_RUN
361
361
362
362
$(H2 $(LNAME2 static_initialization, Static Initialization of AAs))
363
363
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.
365
368
366
369
---------
370
+ // in global scope
367
371
immutable long[string] aa = [
368
372
"foo": 5,
369
373
"bar": 10,
@@ -378,6 +382,11 @@ $(H2 $(LNAME2 static_initialization, Static Initialization of AAs))
378
382
}
379
383
---------
380
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
+
381
390
$(H2 $(LNAME2 runtime_initialization, Runtime Initialization of Immutable AAs))
382
391
383
392
$(P Immutable associative arrays are often desirable, but sometimes
You can’t perform that action at this time.
0 commit comments