Mir Random [WIP]
Ilya Yaroshenko via Digitalmars-d
digitalmars-d at puremagic.com
Tue Nov 22 22:16:39 PST 2016
On Wednesday, 23 November 2016 at 05:58:47 UTC, Ilya Yaroshenko
wrote:
> On Tuesday, 22 November 2016 at 23:55:01 UTC, Andrei
> Alexandrescu wrote:
>> On 11/22/16 1:31 AM, Ilya Yaroshenko wrote:
>>> - `opCall` API instead of range interface is used (similar
>>> to C++)
>>
>> This seems like a gratuitous departure from common D practice.
>> Random number generators are most naturally modeled in D as
>> infinite ranges. -- Andrei
>
> It is safe low level architecture without performance and API
> issues. It prevents users to do stupid things implicitly (like
> copying RNGs). A hight level range interface can be added in
> the future (it will hold a _pointer_ to an RNG). In additional,
> when you need to write algorithms or distributions opCall is
> much more convenient than range API. In additions, users would
> not use Engine API in 99% cases: they will just want to call
> `rand` or `uniform`, or other distribution.
>
> I am sure that almost any library should have low level API
> that is fits to its implementation first. Addition API levels
> also may be added. Current Phobos evolution is generic
> degradation: more generic and "universal" code hide more
> uncovered bugs in the code. The std.range is good example of
> degradation, it has a lot of API and implementation bugs.
>
EDIT: std.range -> std.random
More information about the Digitalmars-d
mailing list