Ranges and random numbers -- again

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Tue Jun 18 09:11:05 PDT 2013


On 6/18/13 11:11 AM, monarch_dodra wrote:
> On Tuesday, 18 June 2013 at 14:39:38 UTC, Andrei Alexandrescu wrote:
>> On 6/18/13 10:16 AM, H. S. Teoh wrote:
>>> I say again that RNGs being passed by value is a major BUG. The above
>>> situation is a prime example of this problem. We *need* to make RNGs
>>> passed by reference. For situations where you *want* to duplicate a
>>> pseudo random sequence, an explicit method should be provided to clone
>>> the RNG. Duplication of RNGs should never be implicit.
>>
>> Occasionally copying a RNG's state is useful, but I agree most of the
>> time you want to just take a reference to it.
>>
>> I think a good way toward a solution is
>> http://d.puremagic.com/issues/show_bug.cgi?id=10404.
>>
>>
>> Andrei
>
> That sounds nice, but is it possible? The only way to truly forward
> everything is via an alias this.

Nonono, that must use introspection and mixins, like WhiteHole and 
BlackHole do.

Andrei




More information about the Digitalmars-d mailing list