First Draft: Static Single Assignment

Jonathan M Davis newsgroup.d at jmdavisprog.com
Tue Nov 18 10:24:17 UTC 2025


On Sunday, November 16, 2025 2:48:32 PM Mountain Standard Time Peter C via dip.development wrote:
> On Sunday, 16 November 2025 at 09:59:19 UTC, Kapendev wrote:
> > On Sunday, 16 November 2025 at 04:16:56 UTC, Peter C wrote:
> >> I propose intead, 'init' -  it (at least to me) directly
> >> evokes an initialization context for the construction of a
> >> variable.
> >
> > I don't think this is a good idea because `init` is a common
> > constant or function name. Not D specific also, just check some
> > code in other languages.
>
> We've had the 'init' keyword in C# for many years now.
>
> https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/keywords/init
>
> init evokes the context of initialization, which is not what C#'s
> 'sealed' would have done.
>
> 'sealed' is D's 'final' btw - and both of those invoke an OOP
> context (structural inheritance and type extension).
>
> I would have thought all the anti-oop people would have given me
> a +1 for suggesting 'init' instead of final ;-)

1. init is already used in D by the language itself to give the value that a
type is default-initialized with - e.g. T.init, int.init, etc.

2. Adding _any_ keyword is a breaking change, so the odds of it happening
are pretty low in general. If there's a strong case for it with a particular
feature, then it might happen, but if an existing keyword can reasonably be
used instead (or some other syntax which wouldn't be a breaking change),
that's almost certainly what's going to happen when adding a feature. It
_might_ happen with a new edition, but even then, it's _highly_ unlikely
that init would be an acceptable keyword given how it's already used.

So, regardless of how much sense it would or wouldn't make to use init for
something like this if we weren't worried about breaking existing code, it's
clearly not going to happen.

- Jonathan M Davis






More information about the dip.development mailing list