Mutate immutable inside shared static constructor

Nick Treleaven nick at geany.org
Sat Mar 23 21:59:57 UTC 2024


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


More information about the Digitalmars-d-learn mailing list