[m-users.] A more precise determinism checker

Dirk Ziegemeyer dirk at ziegemeyer.de
Wed Mar 23 02:35:46 AEDT 2022


> Am 22.03.2022 um 16:05 schrieb Zoltan Somogyi <zoltan.somogyi at runbox.com>:
> 
> 
> 2022-03-23 01:47 GMT+11:00 "Dirk Ziegemeyer" <dirk at ziegemeyer.de>:ecker works fine for about 90 percent of my predicates. I wish there would exist some solution to assist Mercury with the remaining 10 percent.
>> A pattern that happens very frequently to me: I know exactly that a key is not a member of the keys of a map. Inserting this key into the map under this precondition (with map.insert/4) is of determinism det instead of semidet.
> 
> Is there some reason why you cannot call map.det_insert/4 instead of map.insert/4?
> It was created for precisely this purpose.
> 
> In fact, a large fraction of the semidet predicates in the Mercury standard library
> have versions that, like map.det_insert, throw an exception instead of failing.

Using the det versions of these predicates is what I'm doing regularly in these situations. But then I'm reluctantly leaving the save path of compiler guarantees that my program won't abort at runtime.

Dirk.


More information about the users mailing list