Re: bug in doc?

2019-03-14 Thread Dennis via Digitalmars-d-learn
On Thursday, 14 March 2019 at 19:46:30 UTC, spir wrote: But the doc (the language ref for the matter) should definitely say what you just explained above, shouldn't they? Well arguably, the spec should detail the language semantics formally and not just be a description of the reference

Re: bug in doc?

2019-03-14 Thread spir via Digitalmars-d-learn
On 14/03/2019 15:52, H. S. Teoh via Digitalmars-d-learn wrote: On Thu, Mar 14, 2019 at 03:22:52PM +0100, spir via Digitalmars-d-learn wrote: https://dlang.org/spec/hash-map.html#static_initialization: immutable long[string] aa = [ "foo": 5, "bar": 10, "baz": 2000 ]; ==> Error:

Re: bug in doc?

2019-03-14 Thread Daniel N via Digitalmars-d-learn
On Thursday, 14 March 2019 at 14:47:18 UTC, Adam D. Ruppe wrote: On Thursday, 14 March 2019 at 14:22:52 UTC, spir wrote: https://dlang.org/spec/hash-map.html#static_initialization: Well, bug in implementation. That is *supposed* to work, but the compiler never implemented it. The docs

Re: bug in doc?

2019-03-14 Thread H. S. Teoh via Digitalmars-d-learn
On Thu, Mar 14, 2019 at 03:22:52PM +0100, spir via Digitalmars-d-learn wrote: > https://dlang.org/spec/hash-map.html#static_initialization: > > immutable long[string] aa = [ > "foo": 5, > "bar": 10, > "baz": 2000 > ]; > > ==> Error: non-constant expression `["foo":5L, "bar":10L,

Re: bug in doc?

2019-03-14 Thread Adam D. Ruppe via Digitalmars-d-learn
On Thursday, 14 March 2019 at 14:22:52 UTC, spir wrote: https://dlang.org/spec/hash-map.html#static_initialization: Well, bug in implementation. That is *supposed* to work, but the compiler never implemented it. The docs really should point out this fact explicitly, though.

Re: bug in doc?

2019-03-14 Thread Andrea Fontana via Digitalmars-d-learn
On Thursday, 14 March 2019 at 14:22:52 UTC, spir wrote: https://dlang.org/spec/hash-map.html#static_initialization: immutable long[string] aa = [ "foo": 5, "bar": 10, "baz": 2000 ]; If I'm right, you can't use this syntax with global array. Insted this works: void main() {

bug in doc?

2019-03-14 Thread spir via Digitalmars-d-learn
https://dlang.org/spec/hash-map.html#static_initialization: immutable long[string] aa = [ "foo": 5, "bar": 10, "baz": 2000 ]; ==> Error: non-constant expression `["foo":5L, "bar":10L, "baz":2000L]` Also: I don't understand the error message: * What is non-constant in the *expression*? *