First Draft: Static Single Assignment

Nick Treleaven nick at geany.org
Mon Nov 17 11:28:43 UTC 2025


On Monday, 17 November 2025 at 10:25:47 UTC, user1234 wrote:
> 1. The description requires to specify that pass-by-ref a final 
> is (_always almost_) illegal.

The DIP example shows that non-mutable ref to a final variable is 
OK, despite it saying:

> A ref cannot be taken of a final declaration:

I think that sentence should be "A mutable ref cannot...".

> 2. what about parameter storage classes ? (since the 
> StorageClass rule is shared by VarDecl and Param)
>
> ```d
> void v(final int p = 0);
> v(1);
> ```
>
> VS
>
> ```d
> void v(final int p = 0);
> v();
> ```

I think both calls should work. `p` can't be modified inside v's 
body.

> is the default argument stands for a single assignment ?

The default argument is only used when there's no argument.

> which leads to ask what is the right behavior (given first 
> note) for
>
> ```d
> void v(final ref int);
> final int arg;
> v(arg);
> ```

I think that should work, because the call can't modify `arg`.



More information about the dip.development mailing list