[m-dev.] proposal: add uuid module to the standard library

Julien Fischer jfischer at opturion.com
Sat Oct 31 18:56:40 AEDT 2020


On Sat, 31 Oct 2020, Zoltan Somogyi wrote:

> 2020-10-31 17:41 GMT+11:00 "Peter Wang" <novalazy at gmail.com>:
>> On Sat, 31 Oct 2020 17:22:09 +1100 "Zoltan Somogyi" <zoltan.somogyi at runbox.com> wrote:
>>> 
>>> 2020-10-31 17:18 GMT+11:00 "Peter Wang" <novalazy at gmail.com>:
>>> > We do have a uuid module in Prince but all it does is generate random
>>> > UUIDs by reading from a cryptographic RNG (which is platform specific)
>>> > and knocking out the relevant bits, and converting the uuid to a string
>>> > or byte array representation.
>>> 
>>> Julien's module does that too.
>> 
>> (The glue code to read from a cryptographic RNG needs to be supplied.)
>
> This is definitely true. Julien's module wouldn't be really useable
> to create uuids unless the Mercury standard library also had a cryptographic
> RNG.

It uses the RNG type classes we added a release or so ago; the standard
library doesn't necessarily need to provide the generator.

That said, it would obviously be more convenient for Mercury's standard
library to provide access to a cryptographically secure RNG backed by
the system entropy pool.  That's what we were intending when the new
random type classes were added; most of the underlying platforms we
support provide something of the sort, although it's a bit of a can
of worms on some of them (notably Linux).

Julien.


More information about the developers mailing list