First Draft: Static Single Assignment

Peter C peterc at gmail.com
Wed Nov 19 04:33:38 UTC 2025


On Tuesday, 18 November 2025 at 18:05:47 UTC, jmh530 wrote:
>
> ..
> Similarly, assuming this DIP is approved as-is, a newcomer to 
> the language might be a little confused by the snippet below.
>
> ```
> class C {
>     final int f() {}
> }
> ```
>
> Is the function returning a `final int` or is it a `final` 
> method?

Ummm... it's a final method.

module mymodule;
@safe:
private:
import std;

class C
{
     final int f()
     {
         return 0;
     }
}

void main()
{
     if (__traits(isFinalFunction, C.f))
         writeln("C.f is a final method");
     else
         writeln("C.f is not a final method");
}

// C.f is a final method



More information about the dip.development mailing list