First Draft: Static Single Assignment

Richard (Rikki) Andrew Cattermole richard at cattermole.co.nz
Thu Dec 4 09:21:38 UTC 2025


On 04/12/2025 10:06 PM, Walter Bright wrote:
> On 12/3/2025 5:10 PM, Jonathan M Davis wrote:
> 
>     If what you want is truly single assignment, then that's not a
>     question of mutation. It's a question of assignment.
> 
> I cannot see why |final int x = 3; ++x;| should be legal.

Why would we use this, if we have to annotate methods as final?

```d
struct Foo {
	int field;
	void method() final {
		field = 2; // Error
	}
}

final Foo foo;
foo.method;
```

That's const minus the type qualifier.

This capability is what separates this from const, being able to mutate 
the contents of the cell.


More information about the dip.development mailing list