First Draft: Static Single Assignment

Peter C peterc at gmail.com
Fri Dec 5 11:24:30 UTC 2025


On Friday, 5 December 2025 at 06:32:40 UTC, Jonathan M Davis 
wrote:
>
> ..
> If the goal is truly single assignment, then
> x = 42;
> would violate that, but
> ++x;
> would not, because it's not an assignment. It's mutation, yes, 
> but it's not assignment.
> ..
> - Jonathan M Davis

For a primitive type, there is no separate internal structure to 
'mutate'.

For a primitive type, the assignment is the operation that 
changes the state.

  - The processor fetches the current value (42).
  - It calculates the new value (43).
  - It stores the new value (43) back into the memory location 
designated by x.

So, the only way to change the state of a primitive variable, is 
to write a new value into its memory location. This act of 
writing a new value is, by definition, an assignment operation, 
which is a violation of the constraint, so the compiler must 
reject it.

Primitives: The rule [indirectly] results in immutability (same 
as const) - but immutability is the consequence, not the 
intention.

Objects: The rule forces the reference to be single-assigned, 
allowing for mutation of the object's internal state (different 
from const).



More information about the dip.development mailing list