range.save

Jonathan M Davis via Digitalmars-d digitalmars-d at puremagic.com
Fri Nov 27 03:31:12 PST 2015


On Friday, 27 November 2015 at 09:20:23 UTC, Jonathan M Davis 
wrote:
> I'm starting to think that it would be better to have pure 
> input ranges have to be reference types and forward ranges have 
> to be value types and then be very careful about which 
> functions work with both rather than simply treating all 
> forward ranges like pure input ranges that can also be copied 
> via save.

Another piece of this puzzle to consider is that unless a range 
is a value type (or at least acts like a value type as long as 
you don't mutate its elements) or has save called on it, then it 
fundamentally doesn't work with lazy ranges. So, at minimum, we 
need to consider making it so that lazy ranges require forward 
ranges (and then, assuming that we continue to have save, the 
lazy ranges need to always call save on the range that they're 
given).

- Jonathan M Davis


More information about the Digitalmars-d mailing list