Printing a range of ranges drains them

monkyyy crazymonkyyy at gmail.com
Mon May 27 16:28:28 UTC 2024


On Monday, 27 May 2024 at 00:25:42 UTC, Steven Schveighoffer 
wrote:
> 
> So, does anyone expect this behavior? If so, can you explain 
> why you think this is intentionally designed this way?

This is correct behavior for ref front ranges with imperative pop

ref front is a violation of the "views of data", but given the 
current api how else is sorting going to work?

I tried functional pop in my api experiment, it was hard to get 
right and will come with tradeoffs I doubt poeple will accept

possible solutions are:

1. specaility n-depth range functions

2. a upper level to the api, so `auto i=foo[].find!F.key; 
foo[i]=...` is the correct way to mutate data

3. treat ranges of ranges as rare and unimportant



More information about the Digitalmars-d mailing list