[m-rev.] for review: provide alternatives to can-fail functions in the library
Julien Fischer
jfischer at opturion.com
Fri Aug 9 11:44:35 AEST 2024
On Thu, 8 Aug 2024 at 09:30, Zoltan Somogyi <zoltan.somogyi at runbox.com> wrote:
>
> This diff also adds some "XXX STATEVAR"s to library/injection.m.
> The marked predicates have non-statevar-friendly argument orders.
> Given that injection.m is rarely used, I would like to simply change
> those arguments orders in a follow-up diff, noting the change in NEWS.md.
> Does anyone think that we need a more gradual implementation
> of that change?
No, you can go ahead and change them.
> Something that would definitely have more impact is replacing the semidet
> function in the enum typeclass. (The uenum typeclass already has a
> semidet *predicate* in the same role.) Since you cannot obsolete one
> typeclass method in favor of another, I can't think of a way to make any
> changeover any less disruptive than just making the replacement and announcing it,
> and expecting everyone to fix their instance declarations when they next update
> their Mercury standard library. Can anyone else?
There are two sources of potential disruption:
1. Users who have implemented their own instances of the enum typeclass; as you
say they will just need to update.
2. Users who have code that uses the from_int/1 method. For those, we can add
the following to the enum module for the next release:
:- pragma obsolete(func(from_int/1)).
:- func from_int(int) = T is semidet <= enum(T).
This can be deleted after the next release.
The diff looks fine.
Julien.
More information about the reviews
mailing list