Ranges and random numbers -- again

monarch_dodra monarchdodra at gmail.com
Tue Jun 18 10:35:44 PDT 2013


On Tuesday, 18 June 2013 at 16:11:06 UTC, Andrei Alexandrescu 
wrote:
> 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

Hum... just looked at the code. I was hoping there was a way to 
do this without pulling out the heavy artillery...


More information about the Digitalmars-d mailing list