Re: CTFE and assoc array

2020-01-21 Thread H. S. Teoh via Digitalmars-d-learn
On Tue, Jan 21, 2020 at 04:51:35PM -0500, Steven Schveighoffer via Digitalmars-d-learn wrote: [...] > It would be really cool to make AA's at CTFE change into runtime AAs > when used at runtime, and be accessible as compile-time AAs otherwise. [...] I've been wishing for this since the early days

Re: CTFE and assoc array

2020-01-21 Thread Steven Schveighoffer via Digitalmars-d-learn
On 1/19/20 8:02 AM, Andrey wrote: On Saturday, 18 January 2020 at 21:44:35 UTC, Boris Carvajal wrote: I read that thread. But: Deprecation: initialization of immutable variable from static this is deprecated. Use shared static this instead. That should have been noted in the original thread

Re: CTFE and assoc array

2020-01-19 Thread user1234 via Digitalmars-d-learn
On Sunday, 19 January 2020 at 13:02:18 UTC, Andrey wrote: On Saturday, 18 January 2020 at 21:44:35 UTC, Boris Carvajal wrote: I read that thread. But: Deprecation: initialization of immutable variable from static this is deprecated. Use shared static this instead. And we get? No CTFE with s

Re: CTFE and assoc array

2020-01-19 Thread Andrey via Digitalmars-d-learn
On Saturday, 18 January 2020 at 21:44:35 UTC, Boris Carvajal wrote: I read that thread. But: Deprecation: initialization of immutable variable from static this is deprecated. Use shared static this instead. And we get? No CTFE with static immutable AA?

Re: CTFE and assoc array

2020-01-18 Thread Boris Carvajal via Digitalmars-d-learn
On Saturday, 18 January 2020 at 20:54:20 UTC, Andrey wrote: Hello, Why this doesn't work? import std; struct Qwezzz { shared static this() { qaz = qazMap; } enum qazMap = ["rrr": "vv", "hty": "4ft6"]; static immutable string[string] qaz; } void main() { e

CTFE and assoc array

2020-01-18 Thread Andrey via Digitalmars-d-learn
Hello, Why this doesn't work? import std; struct Qwezzz { shared static this() { qaz = qazMap; } enum qazMap = ["rrr": "vv", "hty": "4ft6"]; static immutable string[string] qaz; } void main() { enum sorted = Qwezzz.qaz.keys.sort(); } The variable "qaz" i