Why tuples are not ranges?

Steven Schveighoffer schveiguy at yahoo.com
Sat Jun 30 12:17:04 UTC 2018


On 6/29/18 1:35 PM, Ali Çehreli wrote:
> On 06/28/2018 11:10 PM, Jonathan M Davis wrote:
>  > On Friday, June 29, 2018 05:52:03 Alex via Digitalmars-d-learn wrote:
> 
>  >> Wouldn't this be weird from the semantic view?
> 
> I agree with all your concerns. The fact that Meta decided to make the 
> element type Algebraic!T as opposed to my CommonType!T choice is another 
> semantic problem.
> 
>  > It wouldn't make any sense to turn a Tuple into a range. However, if 
> all of
>  > the values are of the same type, it might make sense to create a 
> range from
>  > each of the values in the Tuple.
> 
> I went a step further and used CommonType!T.

Isn't this what only does? https://dlang.org/phobos/std_range.html#only

-Steve


More information about the Digitalmars-d-learn mailing list