Is this a bug in std.typecons.Tuple.slice?

tsbockman via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sat Feb 6 03:02:37 PST 2016


On Saturday, 6 February 2016 at 08:47:01 UTC, Saurabh Das wrote:
> I think we should add a static assert to slice to ensure that 
> the current implementation is not used in a case where the 
> alignment doesn't match. This is better than failing without 
> any warning.

If we pursue the deprecation route, I agree that this is a 
necessary step.

> We could add new (differently named) functions for slicing 
> non-aligned tuples.
>
> I agree that my approach of removing the ref may break existing 
> code, so if introduced, it should be named differently.
>
> I am not comfortable with tuple(42, true, "abc").slice(1, 3) 
> being different in type from tuple(true, " abc").

Why? What practical problem does this cause?


More information about the Digitalmars-d-learn mailing list