Why use a DFA instead of DIP1000?
Richard (Rikki) Andrew Cattermole
richard at cattermole.co.nz
Mon Sep 15 01:26:31 UTC 2025
On 15/09/2025 7:55 AM, Walter Bright wrote:
> A DFA that only works with a forward pass will generate a lot of
> complaints as people get baffled by the situations where it fails.
>
> The forward pass attribute inference D has generates complaints and bug
> reports when it fails, because it does not handle cycles.
Oh I see where you're thinking.
Okay, consider the following reports, does any report (or lack thereof)
suggest people are going to be baffled by it?
Relevant files (start.d for reports source code, out.txt for full log):
https://gist.github.com/rikkimax/652f96a33934bd8ae0a68fb849821385#file-start-d
```
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(257): Error: Variable `ptr` was required to be non-null
and has become null
foreach (i; 0 .. 2)
^
testdfa\start.d(308): Error: Dereference on null variable `ptr`
int v = *ptr; // error
^
testdfa\start.d(330): Error: Dereference on null variable `ptr`
int v = *ptr; // error
^
testdfa\start.d(613): Error: Assert can be proven to be false
assert(val); // Error: val is 0
^
testdfa\start.d(619): Error: Assert can be proven to be false
assert(stack.length == 1); // Error: stack is null
^
testdfa\start.d(673): Error: Dereference on null variable `ptr`
return *ptr; // error could be null
^
testdfa\start.d(703): Error: Assert can be proven to be false
assert(ptr !is null); // error
^
extracted.d
```
Worth looking at extracted.d and the full log.
More information about the Digitalmars-d
mailing list