Reference semantic ranges and algorithms (and std.random)

jerro a at a.com
Sat Sep 22 13:08:43 PDT 2012


On Friday, 21 September 2012 at 19:47:16 UTC, Jonathan M Davis 
wrote:
> On Friday, September 21, 2012 15:20:49 monarch_dodra wrote:
>> #3
>> The only thing I'm having an issue with is "save". IMO, it is
>> exceptionally dangerous to have a PRNG be a ForwardRange: It
>> should only be saved if you have a damn good reason to do so. 
>> You
>> can still "dup" if you want (manually) (if you think that is
>> smart), but I don't think it should answer true to
>> "isForwardRange".
>
> It is _very_ crippling to a range to not be a forward range. 
> There's lots of
> stuff that requires it. And I really don't see what the problem 
> is. _Maybe_
> it's okay for them to be input ranges and not forward ranges, 
> but in general,
> I think that we need to be _very_ careful about doing that. It 
> can be really,
> really annoying when a range is not a forward range.

Reference type ranges could have a payload property which would 
return the underlying value type range which would be a forward 
range. If you need a forward range, you could just use that.


More information about the Digitalmars-d mailing list