I wasn't entirely sure which post to respond to because I needed Rikki's examples, but this response is for Walter.
On Monday, 15 September 2025 at 01:26:31 UTC, Richard (Rikki) Andrew Cattermole wrote:
>start.d
testdfa\start.d(236): Error: Variable `ptr` was required to be non-null and has become null
foreach (i; 0 .. 2)
^
testdfa\start.d(330): Error: Dereference on null variable `ptr`
int v = *ptr; // error
^
extracted.d
C# has both of the above errors (as warnings) enabled by default.
Walter, the twin assertions that the above errors will be confusing to programmer, and that they will slow down the compiler are entirely false. Millions of programmers every day see messages very similar to those in C# compiler outputs they will know exactly what is meant.
Furthermore, C# is renowned for it's speed. I just built a 250kLOC project in less than one second.
Here is examples of C#'s DFA in action:
Main.xaml.cs(530,22,530,24): warning CS0168: The variable 'ex' is declared but never used
Customers.cs(26,37,26,53): warning CS0649: Field 'Customers.customersService' is never assigned to, and will always have its default value null
DataUploadController.cs(41,46,41,54): warning CS0169: The field 'DataUploadController.resolver' is never used
The VB.NET compiler also has DFA and is equally as fast (they share codebases):
WorkOrderDirectory.vb(26,13): warning BC42024: Unused local variable: 'J'.
The above are all real world examples from the code base that I just rebuilt.
There is no rule that states that DFA must be slow as there exist examples disproving the assertion.