Examples of DFA

Walter Bright newshound2 at digitalmars.com
Tue Sep 23 17:54:57 UTC 2025


On 9/23/2025 2:43 AM, Richard (Rikki) Andrew Cattermole wrote:
> Instead of writing ``@nogc``, we write ``@nogc iff(foo, bar, abc)``.
> 
>  From there its a simple dependency resolver either during the compilation of 
> the three functions or on usage.

It's not so simple when there is recursion in the flow graph.

> 
> This is the basis for my solution to a problem Adam has proposed for PhobosV3, 
> which essentially is the desire to whitelist attributes. Use ``@localnogc`` & if 
> the function calls are all ``@nogc``, therefore the function is allowed to be 
> ``@nogc``.

I am reluctant to try to fix this issue with even more attributes.


> Am I right to assume that the reason you haven't presented this solution, is 
> because you want attributes to be finalized when bar&abc complete?

I showed the solution to illustrate the requirement for iteration and 
convergence to resolve cycles in the flow graph. A DFA that cannot deal with 
recursion is just going to leave people frustrated, as the current @nogc 
inference engine does.



More information about the Digitalmars-d mailing list