On Tue, Jul 29, 2025 at 10:57:50PM +0000, Brother Bill via Digitalmars-d-learn 
wrote:
> ```
> import std.stdio;
> 
> immutable int[] i;
> 
> shared static this() {
>       writeln("In shared static this()");
>       i ~= 43;
> }

`i` is immutable, so it's illegal to use mutating operations like ~= on it.

But since you're inside a static module ctor, you can assign to the
array instead:

        i = [ 43 ];

should work.


T

-- 
Why does this impressionist painting look like coins falling from the sky?  
It's Cloud Monet.

Reply via email to