[m-users.] The new random module(s)
jfondren at minimaltype.com
Thu Sep 5 15:46:49 AEST 2019
On 2019-09-05 00:17, Mark Brown wrote:
> Since you are using this module, can I ask your opinion on how long to
> keep the old implementation around? Removing it will force people to
> update their code sooner, but will also free up the namespace so we
> can add a new version of random.permutation/4.
> Or we could add them now, both to the random module, if the names are
> changed to permute_array and permute_list.
It seems weird to me that the predicate is random.permutation/4 at all,
and not list.permutation/4. In the permute_array/permute_list future,
will permute_X be added for other data structures? And will random then
have to occasionally contain duplicate code (or import secret parts of
module interfaces) so that it can efficiently access underlying data
structures to do these permutations?
And permute_X seems like an odd naming scheme when Mercury is fine with
permutation(!X, !RS), % !X is an array
permutation(!Y, !RS), % !Y is a list
if these refer unambiguously to permute/4 of two separate modules with
As for how long to keep the old code, mainly I wouldn't want to put "you
need to get a ROTD between these two dates" in a README. But that could
only happen after at least one more breaking change, or if I couldn't
avoid a bug that was fixed after a breaking change.
> (Initially I put the new stuff all in a new module, which avoids the
> namespace clashes, but we do actually want the module to be named
> "random" in the long run.)
More information about the users