[m-rev.] time additions (was Re: for review: Add random.init/3)

Julien Fischer jfischer at opturion.com
Sat May 28 15:15:08 AEST 2016


Hi Mark,

On Sat, 28 May 2016, Mark Brown wrote:

> Hi,
>
> On Sat, May 28, 2016 at 12:50 PM, Julien Fischer <jfischer at opturion.com> wrote:
>> On Fri, 27 May 2016, Sebastian Godelet wrote:
>>>> The ultimate problem here is that Mercury's current random and time
>>>> modules are simply not very good.  For random, what the standard library
>>>> *should* be providing is a generic interface to random number generators
>>>> in general (e.g. something along the lines of Boost.Random, but using
>>>> type classes), along with some actual instances of generators.
>>>
>>>
>>> Yes if I understood correctly typeclasses are not used that much in
>>> the standard library since they pre-date it, right?
>>
>>
>> To a large extent; the lack of support for constructor classes in the
>> type class system has also meant that it isn't quite expressive enough
>> to make their wholesale addition to the standard library worth it.
>
> Providing an interface to random number generators is not a wholesale
> addition, though. Is there any proposal for such an interface that
> actually involves constructor classes? (Or is this more of an excuse
> than a reason ;-))

Ok, I wasn't terribly clear there :-(  What I meant is that the lack
of type classes throughout the library _in general_ is largely due to
the lack of constructor classes -- we cannot, for example, provide
classes that abstract the various container types without them.
In the specific case of a RNGs there is no problem with adding new
classes (or indeed in any other case that doesn't require constructor
classes).

Julien.


More information about the reviews mailing list