Is this a bug in std.typecons.Tuple.slice?
tsbockman via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Fri Feb 5 23:57:08 PST 2016
On Saturday, 6 February 2016 at 06:34:05 UTC, Marco Leise wrote:
> I don't want to sound dismissive, but when that thought came
> to my mind I considered it unacceptable that the type of
> Tuple!(int, bool, string).slice(1, 3) would be something
> different than Tuple!(bool, string). In your case
> Tuple!(TuplePad!4LU, bool, string). That's just a matter of
> least surprise when comparing the types.
>
> I'll let others decide, since I never used tuple slices.
I'm not sure which approach is ultimately better, but aside from
the performance implications, your "needed change" could break a
lot of valid code in the wild - or it might break none; it really
just depends on whether anyone actually *uses* the `ref`-ness of
the `Tuple.slice` return type.
(It appears that Phobos, at least, does not. But there is no
guarantee that the rest of the world is using `Tuple` only in the
ways that Phobos does.)
Leaving aside bizarre meta-programming stuff (because then
*anything* is a breaking change), my PR does not break any code,
except that which was already broken: the type of the slice is
only different in those cases where it *has* to be, for alignment
reasons; otherwise it remains the same as it was before.
More information about the Digitalmars-d-learn
mailing list