Skip to content

Revert "Added a note to the doc saying that the feature is not yet implemented." #2946

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion spec/hash-map.dd
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,8 @@ $(H2 $(LNAME2 advanced_updating, Advanced updating))

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

NOTE: Not yet implemented.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Firstly, "not yet implemented" is terrible for a language specification - so getting rid of it is good.

This behaviour needs to be better described - also a note on the word behaviour: In the context of a language specification the aim is not to describe what the language does in reality, but what it should do in order for it to be consistent in some desirable way.

https://dlang.org/spec/declaration.html#global_static_init The spec declares that this behaviour should be implemented for D to be compliant with its own specification in the sense that this declaration should be evaluable at compile time - in this case the expression is evaluable but for whatever (druntime) reason cannot be assigned to anything global or static.

The behaviour needs to be elaborated upon and the non-compliance noted in a more concrete way with an example.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I elaborated a bit more, similarly to static initialization of normal arrays. I also added a more elaborated note about not being implemented on dmd compiler.

$(P Static initalizations are supplied by a list of key value elements using
`key : value` syntax enclosed in [ ].)

---------
immutable long[string] aa = [
Expand All @@ -354,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
Expand Down