[m-users.] Mode selection
ttmrichter at gmail.com
Thu Oct 16 13:39:23 AEDT 2014
Documenting something as fundamental as the selection algorithm used deep
in compiler internals or on an ephemeral construct like a mailing list
seems a bit whimsical. Does this not belong in the reference manual under
the modes chapter?
On 16 October 2014 09:33, Julien Fischer <jfischer at opturion.com> wrote:
> On Thu, 16 Oct 2014, Paul Bone wrote:
>> This question came up on IRC today. Consider append/3:
>> :- pred append(list(T), list(T), list(T)).
>> :- mode append(in, in, out) is det.
>> :- mode append(out, out, in) is multi.
>> And a call to append with each of it's arguments fully instantiated.
>> % I've written these out so that I can name them and refer to them
>> % below.
>> A = [1, 2],
>> B = ,
>> C = [1, 2, 3],
>> append(A, B, C).
>> This is a case where "append(in, in, in) is semidet" is an implied mode.
>> While it makes no (declarative semantics) difference, which mode of append
>> will be used here? Does the compiler select the first mode that fits or
>> "best" mode?
>> A follow up question. What if the implied mode is written down in the
> See the comment above the predicate choose_best_match/8 in
> compiler/modecheck_call.m. It describes the selection algorithm used.
> Or indeed just see the mailing list archives, as this question has
> been asked (and answered!) before.
> users mailing list
> users at lists.mercurylang.org
"Perhaps people don't believe this, but throughout all of the discussions
of entering China our focus has really been what's best for the Chinese
people. It's not been about our revenue or profit or whatnot."
--Sergey Brin, demonstrating the emptiness of the "don't be evil" mantra.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the users