Why tuples are not ranges?

Alex sascha.orlov at gmail.com
Fri Jun 29 05:52:03 UTC 2018


On Thursday, 28 June 2018 at 19:02:51 UTC, Ali Çehreli wrote:
> On 06/28/2018 11:08 AM, Mr.Bingo wrote:
>
> > Thanks, why not add the ability to pass through ranges and
> arrays and
> > add it to phobos?
>
> Makes sense. It needs an enhancement request at 
> http://issues.dlang.org/, a good implementation, and a pull 
> request. :)
>
> Ali

Wouldn't this be weird from the semantic view?

Assume, I define a tuple with named fields "key" and "value", 
where a popFront is defined.
Now, I use popFront.
Is the "key" field still available? Why? Or, why not?
What happens, if I name a field of a tuple "front"? Is it 
available after using popFront? And where does it point to?

I mean, I use something similar in my own project, but doesn't 
one has to make a clear distinction between a container and a 
slice of this container? Or should static arrays be unified in 
the same manner?


More information about the Digitalmars-d-learn mailing list