Mutate immutable inside shared static constructor
Menjanahary R. R.
megnany at afaky.com
Sun Mar 24 11:18:16 UTC 2024
On Saturday, 23 March 2024 at 21:59:57 UTC, Nick Treleaven wrote:
> On Saturday, 23 March 2024 at 21:53:43 UTC, Jonathan M Davis
> wrote:
>> Yes, it's a bug. It's a clear violation of the type system if
>> a non-mutable variable is ever given a value more than once.
>> It should be initialized, and then it should be treated as
>> illegal to ever assign to it - or to do anything else which
>> would mutate it. So, clearly, the logic in static constructors
>> with regards to non-mutable variables is overly simple at the
>> moment.
>
> Thanks, filed:
> https://issues.dlang.org/show_bug.cgi?id=24449
Thanks for your prompt answer.
More information about the Digitalmars-d-learn
mailing list