[m-rev.] for review: document require_tail_recursion pragmas
Julien Fischer
jfischer at opturion.com
Wed Jun 10 17:37:52 AEST 2026
On Wed, 10 Jun 2026 at 17:14, Zoltan Somogyi <zoltan.somogyi at runbox.com> wrote:
>
>
>
> On Wed, 10 Jun 2026 16:59:34 +1000, Julien Fischer <jfischer at opturion.com> wrote:
> > > +In declarative languages such as Mercury,
> No, I did mean tail calls in general, not just tail recursive calls.
> This is a visible difference between LLDS and MLDS grades:
> LLDS can do any tail call, MLDS can do only tail RECURSIVE calls.
> I then forgot to add the paragraph I intended to add about this :-(
> I will post this later.
>
> > > +The exception applies to conjunctions that contain two or more recursive calls,
> > > +as in the recursive clause of quicksort.
> > > +Since obviously only the last of these calls can be a tail call,
> >
> > Delete "obviously".
>
> Why?
It seems redundant.
> > > + at item in_all_grades
> > > +Tell the compiler to generate a diagnostic for non-tail recursion
> > > +even in grades that do not allow the possibility of tail recursion.
> > > +In such grades, which include debugging and deep profiling grades,
> >
> > s/include/includes/
> >
> > I suggest emphasising that as well.
>
> If there are any other such grades, I would prefer to list them explicitly.
> Do you know any?
As mentioned elsewhere, the agc grades do, but they're not publicly documented.
Do the various forms of minimal model tabling prevent it?
> Does trailing disable tail recursion?
No, it doesn't. It might alter what is considered tail recursive, due to calls
to trail management operations being inserted, although I'd need to think
about the interaction between the two in more detail.
Julien.
More information about the reviews
mailing list