First Draft: Static Single Assignment

Peter C peterc at gmail.com
Fri Dec 5 23:19:22 UTC 2025


On Friday, 5 December 2025 at 23:05:54 UTC, Juraj wrote:
> On Friday, 5 December 2025 at 22:35:04 UTC, Peter C wrote:
>> On Tuesday, 2 December 2025 at 07:50:57 UTC, Walter Bright
>
>> This should be allowed:
>>
>> final int x; // A final variable declared without an 
>> initializer.
>> x = 42; // currently getting -> Error: cannot modify `final x`
>
> I suggest keeping the topic about D and not a hypothetical 
> language.
> I in this case `x` is already initialized, so by this DIP, it 
> can not be changed.

I'm pretty sure I *was* talking about D...

In any case...

single assignment semantics say: you can assign exactly once.

where in this declaration, am i assigning?

final int x;

If the compiler counts default initialization as an assignment, 
then I've already 'used up' my one assignment before I even touch 
the variable!



More information about the dip.development mailing list