[m-rev.] for post-commit review: better diagnostic for missing higher order insts

Julien Fischer jfischer at opturion.com
Wed Jul 26 16:00:13 AEST 2023


On Wed, 26 Jul 2023, Peter Wang wrote:

> On Tue, 25 Jul 2023 20:15:28 +1000 "Zoltan Somogyi" <zoltan.somogyi at runbox.com> wrote:
>> 
>> On 2023-07-25 07:10 +02:00 CEST, "Peter Wang" <novalazy at gmail.com> wrote:
>> > On Tue, 25 Jul 2023 07:35:35 +1000 "Zoltan Somogyi" <zoltan.somogyi at runbox.com> wrote:
>
>> I just noticed this mode:
>> 
>> :- mode foldl(in(pred(in, di, uo) is semidet), in, di, uo) is semidet.
>> 
>> How useful can this be if the failure of any invocation of the predicate
>> destroys the accumulator without the possibility of getting it back
>> on backtracking?
>
> The log message for commit 22a38ec1f says it was
> "required by an experimental branch of G12."

That was true at the time that log message was written. It's required by
actual G12 now and has been for over a decade.  That mode makes sense.
In G12, it's typically used inside propagator implementations. Inside
those there two requirements:

  1. Operations are sequenced in order given by the programmer --
  threading a unique piece of state achieves that.

  2. The propagator implementation cannot leave choice points behind --
  being semidet does that.

The final value of the accumulator is only "needed" if the propagator
succeeds. If it fails, then the value is never looked at because the
call that created the unique state is also backtracked over.

Julien.


More information about the reviews mailing list