First Draft: Static Single Assignment

Peter C peterc at gmail.com
Mon Nov 17 05:36:55 UTC 2025


On Sunday, 16 November 2025 at 22:08:02 UTC, Nick Treleaven wrote:
>
> ...
> So I assume `typeof(&f)` would be `const int*`?

'final' (or 'init' as I prefer to call it) is a single-assignment 
restriction, and certainly not a type qualifier.

so.. with that specific point in mind...

final int f = 3;
f = 4; // Error: Cannot assign to f. It has been constrained to a 
single-assignment restriction.
int* p = &f; // Error, cannot create a mutable reference to a 
single-assignment variable.
const int* pc = &f; // ok

  - The type of f is just int.
  - typeof(&f) -> taking the address of an int just yields an int*.
  - int* p = &f; // To preserve the integrity of the immutable 
binding (f = 4), this must be rejected by the compiler.
  - const int* pc = &f; // ok, as const helps to support the the 
single-assignment restriction -> that f has been assigned to the 
value 3.




More information about the dip.development mailing list