[m-rev.] for post-commit review: array.generate_foldl2

Julien Fischer jfischer at opturion.com
Fri Aug 20 16:22:09 AEST 2021


Hi Zoltan,

On Fri, 20 Aug 2021, Zoltan Somogyi wrote:

> For review by Julien, of one aspect in particular.
>
> The array module has a whole bunch of fold-like predicates,
> most of which have six mode declarations, in a 3x2 matrix,
> with three arg mode pairs and two determiniisms. The modes are
> <in,out>, <mdi,muo> and <di, uo>, while the determinisms are
> det and semidet. While this seems logical, I don't know why the
> <di, uo> arg mode pair has a semidet version: once the unique
> input arg has been destroyed, there is no way to get it back
> after a failure.
>
> You added several of those mode declarations. I strongly suspect
> that you added them only for symmetry with the <mdi,muo> semidet
> versions, but I would like to know whether you had any use cases
> where it was ok for a failure to destroy the only copy of a di
> (NOT mdi) input.

The semidet (di,uo) folds were added across pretty much the entire
standard library for use by G12. Using uniquely thread state is
how the G12 system enforces the requirement that propagators cannot
leave choice points behind. Propagation can of course fail, hence
the determinism being semidet.  The state in question is only live,
while the propagator is runnning, if the propgator fails we backtrack
over the point at which is created anyway.

As a matter of course, when most of these folds were added I added
all of the above modes since otherwise I kept being interupted with
requests to add one mode or another.

The diff looks fine.

Julien.


More information about the reviews mailing list