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

Marc Schütz via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Tue Feb 9 05:43:16 PST 2016


On Tuesday, 9 February 2016 at 11:38:14 UTC, Ola Fosheim Grøstad 
wrote:
> On Tuesday, 9 February 2016 at 10:54:42 UTC, Marc Schütz wrote:
>> No need to restrict the language here, there's nothing 
>> stopping a decent compiler from storing tuples (actually 
>> _anything_) in registers, in some cases even if references are 
>> taken. I'm pretty sure LLVM can handle this.
>
> If you don't restrict the language people will write code that 
> the optimizer will struggle with.

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?

> LLVM can only handle what goes on within a compilation unit, 
> and not if there are stores, because those are visible in other 
> threads.
>
> Tuples should be considered immutable constants (think 
> functional programming), not in-memory storage.
>

Again, why?

> Tuple's can serve as a good approximation to SIMD registers.

What relation does that have to the above?


More information about the Digitalmars-d-learn mailing list