From 9c83f448775ce98f69741b084cacf65c6ca35163 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lu=C3=ADs=20Ferreira?= Date: Fri, 12 Feb 2021 23:31:40 +0000 Subject: [PATCH 1/2] Revert "Added a note to the doc saying that the feature is not yet implemented." MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit 8b96e90cd7afb965ab908dfe24b6df1514dbc702. Static Initialization of AAs is implemented in D. This note is misleading and people can interpret this wrongly. Signed-off-by: Luís Ferreira --- spec/hash-map.dd | 2 -- 1 file changed, 2 deletions(-) diff --git a/spec/hash-map.dd b/spec/hash-map.dd index a343d94662..506d72b7ed 100644 --- a/spec/hash-map.dd +++ b/spec/hash-map.dd @@ -337,8 +337,6 @@ $(H2 $(LNAME2 advanced_updating, Advanced updating)) $(H2 $(LNAME2 static_initialization, Static Initialization of AAs)) - NOTE: Not yet implemented. - --------- immutable long[string] aa = [ "foo": 5, From 68eb90db09f30b4e1784656d904253db5fd70347 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lu=C3=ADs=20Ferreira?= Date: Mon, 31 May 2021 12:52:11 +0100 Subject: [PATCH 2/2] spec: add more information about static initialization of associative arrays MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Luís Ferreira --- spec/hash-map.dd | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/spec/hash-map.dd b/spec/hash-map.dd index 506d72b7ed..2e50862dd4 100644 --- a/spec/hash-map.dd +++ b/spec/hash-map.dd @@ -337,6 +337,9 @@ $(H2 $(LNAME2 advanced_updating, Advanced updating)) $(H2 $(LNAME2 static_initialization, Static Initialization of AAs)) + $(P Static initalizations are supplied by a list of key value elements using + `key : value` syntax enclosed in [ ].) + --------- immutable long[string] aa = [ "foo": 5, @@ -352,6 +355,13 @@ $(H2 $(LNAME2 static_initialization, Static Initialization of AAs)) } --------- + $(P These associative arrays are statically allocated when they appear in + global scope. Otherwise, they need to be marked with const or static storage + classes to make them statically allocated associative arrays.) + + $(NOTE Statically allocated associative arrays is not currently implemented + in dmd compiler.) + $(H2 $(LNAME2 runtime_initialization, Runtime Initialization of Immutable AAs)) $(P Immutable associative arrays are often desirable, but sometimes