[m-users.] Mode selection

Paul Bone paul at bone.id.au
Fri Oct 17 17:40:23 AEDT 2014

On Fri, Oct 17, 2014 at 01:00:04AM +1100, Mark Brown wrote:
> On Thu, Oct 16, 2014 at 11:51 PM, Paul Bone <paul at bone.id.au> wrote:
> > This was also one of my concerns, that in a specification we don't want to
> > over-specify details that don't affect the declarative semantics.  However,
> > that depends on how much the reference manual is a "reference manual" and
> > how much it is a "specification".
> >
> > I agree that this information should be in the reference manual but
> > with a note saying that Mercury implementations are free to choose their own
> > algorithm and that we're describing (rather than prescribing) the behaviour
> > of mmc.
> Just to clarify, I think there should be a prescribed definition, but
> only applying to the strict sequential semantics. My answer to Michael
> was no because the full definition didn't belong in the Modes chapter,
> not because it didn't belong in the reference manual, and not because
> the Modes chapter couldn't be more informative. Sorry for the
> confusion.

I agree that there should be a full definition for the strict sequential
semantics.  But maybe there should be some "rules" (incomplete definition)
for the normal semantics.  For example it may be useful to specify that:

    :- pred foo(a, b).
    :- mode foo(in, out) is multi.
    :- mode foo(out, in) is det.


    foo(bar, baz).

Results in the second mode (the det mode) being selected.  That is it
probably shouldn't be up to Mercury implementations to choose this obviously
more efficient mode when it can be specified in the language specification.
Or can someone think of a reason why a reasonable implementation might
select the first mode?


Paul Bone

More information about the users mailing list