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

Ola Fosheim Grøstad via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Tue Feb 9 06:28:35 PST 2016


On Tuesday, 9 February 2016 at 13:43:16 UTC, Marc Schütz wrote:
> So what? Using that argument, you could just as well forbid 
> taking the address of any variable. What's so special about 
> tuples, in contrast to structs and arrays?

Some key common qualities for a tuple:

1. They are primarily used for multiple return values from 
functions.

2. Tuples use structural typing, not nominal typing.

3. They are identity-less. If you can take reference and compare, 
they no longer are identity-less.


>> Tuples should be considered immutable constants (think 
>> functional programming), not in-memory storage.
>
> Again, why?

Because that is how a tuple is commonly defined, for performance 
and semantic reasons.


>> Tuple's can serve as a good approximation to SIMD registers.
>
> What relation does that have to the above?

You don't want to spill out SIMD registers to the stack if you 
can avoid it. You want to do the changes within the CPU pipeline, 
i.e. using copies (and register renaming).



More information about the Digitalmars-d-learn mailing list