First Draft: Static Single Assignment

Peter C peterc at gmail.com
Wed Dec 3 04:05:28 UTC 2025


On Tuesday, 2 December 2025 at 07:50:57 UTC, Walter Bright wrote:
> Initial implementation:
>
> https://github.com/dlang/dmd/pull/22171


With the changes, I was expecting an error here (which I didn't 
get):

module mymodule;
@safe:
private:
import std;

class Bag
{
     final int[] items; // This is a binding-level guarantee - 
also acts an API invariant.
     this() { items = []; }
}

void main()
{
     auto b = new Bag();
     b.items ~= 1; // fine. still mutable.
     b.items = []; // was expecting an error here??
}



More information about the dip.development mailing list