Range Redesign: Copy Semantics

Atila Neves atila.neves at gmail.com
Mon Jan 22 15:41:35 UTC 2024


On Sunday, 21 January 2024 at 05:00:31 UTC, Jonathan M Davis 
wrote:
> I've been thinking about this for a while now, but with the 
> next version of Phobos which is in the early planning stages, 
> we really should do some redesigning of ranges. Most of their 
> API is just fine how it is, but there are some aspects of it 
> which really should be changed if we want them to be better 
> (the most obvious one being the removal of auto-decoding). But 
> what I'd like to discuss specifically in this thread is fixing 
> - and defining - the semantics of copying and assigning to 
> ranges. Specifically, the semantics of stuff like
>
> [...]

I don't think I've ever encountered a situation where reference 
ranges would have been desirable - I've never used one.

I think that `.save` was a historical mistake, and that ranges 
that can be copied are forward ranges. Something like a range 
reading from stdin or a socket would/should disable the 
copy/postblit constructors.

Has anyone here used the class-based ranges?


More information about the Digitalmars-d mailing list