Does anyone care if Tuple.slice() returns by ref?

ZombineDev via Digitalmars-d digitalmars-d at puremagic.com
Sun Feb 7 00:54:08 PST 2016


On Sunday, 7 February 2016 at 07:31:51 UTC, tsbockman wrote:
> On Sunday, 7 February 2016 at 07:00:04 UTC, Saurabh Das wrote:
>> On Sunday, 7 February 2016 at 03:16:48 UTC, tsbockman wrote:
>>> (If we go with Saurabh Das' approach, we'll deprecate the old 
>>> slice() by ref method, so it there won't be any *silent* 
>>> breakage either way.)
>>
>> Can we keep the old by ref slice() method, but add guards to 
>> disallow cases where the alignment is off?
>
> Honestly, I think it will just confuse people if the 
> slice-by-ref method only works on some seemingly-random subset 
> of Tuple instantiations - especially since the subset that 
> worked would be platform dependent.
>
> We should either fix it, or deprecate it.

Contrary to my expectations, slicing bultin tuples returns a 
copy. (http://dpaste.dzfl.pl/fd96b17e735d)
Maybe we need to fix this in the compiler. That way we can reuse 
the language feature for std.typecons : Tuple.slice().


More information about the Digitalmars-d mailing list