[m-users.] How to avoid warning about highly ambiguous overloading
Zoltan Somogyi
zoltan.somogyi at runbox.com
Tue Jul 19 22:26:36 AEST 2016
While X = map.init could be a reference to either the function
or the predicate version of map.init, map.init(X) can only be a reference
to the predicate version. In many cases, this technique will avoid
ambiguity with shorter code than using explicit type qualification.
Zoltan.
-------- Original message --------
From: Dirk Ziegemeyer <dirk at ziegemeyer.de>
Date:2016/07/19 2:14 PM (GMT+01:00)
To: Mark Brown <mark at mercurylang.org>
Cc: Mercury Users <users at lists.mercurylang.org>
Subject: Re: [m-users.] How to avoid warning about highly ambiguous
overloading
Hi Mark,
>> I create several emtpy maps with the function map.init/0 and mercury warns me about highly ambiguous overloading.
>
> Note that this can occur as a consequence of other errors, so it can
> help to fix any other errors first before tackling the ambiguous
> overloading.
>
>> Can I use explicit type qualification to tell Mercury that I mean the function map.init/0 instead of the predicate map.init/1?
>
> Yes. If you want map.init to mean the function which returns, say,
> map(a, b), then write
>
> map.init : map(a, b)
Thank you for helping me with the syntax of explicit type qualification. This works perfectly.
Dirk
_______________________________________________
users mailing list
users at lists.mercurylang.org
https://lists.mercurylang.org/listinfo/users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mercurylang.org/archives/users/attachments/20160719/14c79715/attachment.html>
More information about the users
mailing list