How is chunkBy supposed to behave on copy

H. S. Teoh hsteoh at quickfur.ath.cx
Mon Mar 23 17:37:16 UTC 2020


On Sun, Mar 22, 2020 at 04:23:27PM +0000, Paul Backus via Digitalmars-d wrote:
> On Sunday, 22 March 2020 at 15:43:45 UTC, H. S. Teoh wrote:
> > On Fri, Mar 20, 2020 at 05:50:26PM -0600, Jonathan M Davis via
> > Digitalmars-d wrote: [...]
> > > And exactly what should happen with basic input ranges is not
> > > clear, because while ideally, you'd just require that they have
> > > full-on reference semantics, that tends to mean that you're
> > > forcing them to be allocated on the heap, which isn't really the
> > > sort of thing that we want to force if we can avoid it.
> > [...]
> > 
> > You could just have input ranges be a struct with the copy ctor
> > @disable'd, perhaps?
[...]
> Technically, this is already legal--isInputRange accepts non-copyable
> structs.
> 
> Of course, if you accept non-copyable ranges as legitimate, someone
> has to go and fix all of std.algorithm and std.range to handle them
> correctly, which is a non-trivial amount of work.

I don't think it's wise to do this with the existing codebase. A change
as drastic as removing .save will likely require rewriting not just
large chunks of Phobos, but existing user code as well.  This is
probably best left to Phobos v2, if that ever happens.


T

-- 
An elephant: A mouse built to government specifications. -- Robert Heinlein


More information about the Digitalmars-d mailing list