Re: Mir Random and Dlang Ranges [Example]

2016-11-25 Thread Joseph Rushton Wakeling via Digitalmars-d
On Friday, 25 November 2016 at 16:08:15 UTC, Ilya Yaroshenko wrote: On Friday, 25 November 2016 at 16:04:07 UTC, Andrei Alexandrescu wrote: I'd say we can bury the hatchet and move on with Ilya's API. -- Andrei Yes, this was clear. There are also others who may disagree. This is the reason fo

Re: Mir Random and Dlang Ranges [Example]

2016-11-25 Thread Joseph Rushton Wakeling via Digitalmars-d
On Friday, 25 November 2016 at 15:56:45 UTC, Ilya Yaroshenko wrote: What kind of state should not be copied by value? I thought it is only an Engine. Unfortunately that's not true. The sampling algorithm pulls some tricks to try to reduce the number of calls to the random number generator (a

Re: Mir Random and Dlang Ranges [Example]

2016-11-25 Thread Ilya Yaroshenko via Digitalmars-d
On Friday, 25 November 2016 at 16:04:07 UTC, Andrei Alexandrescu wrote: On 11/25/16 10:30 AM, Ilya Yaroshenko wrote: On Friday, 25 November 2016 at 15:22:36 UTC, Joseph Rushton Wakeling wrote: On Friday, 25 November 2016 at 15:04:24 UTC, Andrei Alexandrescu wrote: I thought I agreed that a nonc

Re: Mir Random and Dlang Ranges [Example]

2016-11-25 Thread Andrei Alexandrescu via Digitalmars-d
On 11/25/16 10:30 AM, Ilya Yaroshenko wrote: On Friday, 25 November 2016 at 15:22:36 UTC, Joseph Rushton Wakeling wrote: On Friday, 25 November 2016 at 15:04:24 UTC, Andrei Alexandrescu wrote: I thought I agreed that a noncopyable struct with opCall is fine in conjunction with a range API adapt

Re: Mir Random and Dlang Ranges [Example]

2016-11-25 Thread Ilya Yaroshenko via Digitalmars-d
On Friday, 25 November 2016 at 15:09:46 UTC, Joseph Rushton Wakeling wrote: * its own internal state (or at least, those parts of it that correspond to state underlying the pseudo-random process, which is NOT limited to the RNG state) is not at risk of being copied by value; What kind of stat

Re: Mir Random and Dlang Ranges [Example]

2016-11-25 Thread Ilya Yaroshenko via Digitalmars-d
On Friday, 25 November 2016 at 15:22:36 UTC, Joseph Rushton Wakeling wrote: On Friday, 25 November 2016 at 15:04:24 UTC, Andrei Alexandrescu wrote: I thought I agreed that a noncopyable struct with opCall is fine in conjunction with a range API adapter that uses a pointer. -- Andrei FWIW, I s

Re: Mir Random and Dlang Ranges [Example]

2016-11-25 Thread Joseph Rushton Wakeling via Digitalmars-d
On Friday, 25 November 2016 at 15:04:24 UTC, Andrei Alexandrescu wrote: I thought I agreed that a noncopyable struct with opCall is fine in conjunction with a range API adapter that uses a pointer. -- Andrei FWIW, I suspect that Ilya means simply that it became long and convoluted, not that a

Re: Mir Random and Dlang Ranges [Example]

2016-11-25 Thread Joseph Rushton Wakeling via Digitalmars-d
On Friday, 25 November 2016 at 14:27:13 UTC, Ilya Yaroshenko wrote: The discussion [2] about Mir Random [1] and Range API become a holy war [2]. I am putting the following example here. It also can be found at GitHub[1]. It's not a holy war, but your code example doesn't really address the ke

Re: Mir Random and Dlang Ranges [Example]

2016-11-25 Thread Andrei Alexandrescu via Digitalmars-d
On 11/25/16 9:27 AM, Ilya Yaroshenko wrote: The discussion [2] about Mir Random [1] and Range API become a holy war [2]. I thought I agreed that a noncopyable struct with opCall is fine in conjunction with a range API adapter that uses a pointer. -- Andrei

Mir Random and Dlang Ranges [Example]

2016-11-25 Thread Ilya Yaroshenko via Digitalmars-d
The discussion [2] about Mir Random [1] and Range API become a holy war [2]. I am putting the following example here. It also can be found at GitHub[1]. -- import std.range, std.stdio; import random; import random.variable: NormalVariable; // Engines are allocated on stack or global auto