How is `auto` and not `alias` appropriate for alias sequences?

Meta via Digitalmars-d digitalmars-d at puremagic.com
Sat Dec 12 00:23:08 PST 2015


On Saturday, 12 December 2015 at 06:15:10 UTC, Shriramana Sharma 
wrote:
> Another twist to this is that the tuple created by .tupleof 
> doesn't really seem to be a new object of type Tuple!()

Correct. There's no relation between Tuple and what .tupleof 
produces. The notion of what constitutes a "tuple" in D is 
somewhat complicated.


> So the exact nature of the object produced by .tupleof is still 
> a mystery to me. Would be good if someone threw more light on 
> it.

It's more or less a type internal to the compiler that shares 
some of its properties with AliasSeq, but I believe that it's 
subtly different, such as what you mentioned about it being a 
"view" on a struct/object.


> Also: what is the use of presenting the members of a 
> struct/class as a tuple? Is it iteration?

Yes, and I also believe that assigning to the .tupleof of a 
struct/object bypasses protected/private.


More information about the Digitalmars-d mailing list