[m-dev.] Tail recursion warning proposal
paul at bone.id.au
Thu Jan 19 22:20:38 AEDT 2017
On Thu, Jan 19, 2017 at 05:49:49PM +1100, Michael Day wrote:
> Hi Paul,
> >I have proposed and partly implemented a pragma that can enable and disable
> >the tail recursion warning. In some ways it offers more control than
> >Zoltan's recent scope goal, and in other ways it offers less.
> I'm struggling to understand the ramifications of these new warning controls
> and how they might play out in different situations.
> Do these scenarios sound reasonable:
> 1. Tail recursion warnings are disabled, the default.
> 2. Tail recursion warnings are enabled for all predicates by command-line
> 3. Tail recursion warnings are enabled for specific predicates by pragma.
> 4. Tail recursion warnings are enabled for all predicates by command-line
> option, then disabled for specific predicates by pragma.
> I'm not really sure of the more subtle scenarios like distinguishing between
> self / mutual recursion, when would they be used?
If you did a fair amount of your development in a low-level C grade, but
also knew that you needed to support other grades. By using the
self_recursion_only option you would get more immediate feedback when you
introduced mutual recursion that the MLDS cannot handle.
self_and_mutual recursion is the default, it's what happens when you don't
specify one of these three options.
scc(...) is good if you want to limit the size of the SCC. This can be
useful for other reasons, such as helping to limit the computational
complexity of code. It doesn't affect it directly but it might help prevent
it getting out of hand.
More information about the developers