On Thursday, 27 September 2012 at 10:58:12 UTC, Jonathan M Davis
wrote:
On Thursday, September 27, 2012 11:37:10 foobar wrote:
I do _not_ want to consider two different _structs_ (nominal
types) as the same type. I would like to get correct tuple
semantics which means _structural_ typing (I thought I
emphasized
that enough in the OP).
A tuple is defined by its contained types, *not* its name.
What on earth does structural typing get you here? A tuple is a
collection of
values of varying types. If you have Tuple!(X, Y, Z), it
defines a tuple
containing the types X, Y, and Z. _All_ tuples with those types
will be Tuple!
(X, Y, Z). The _only_ reason that this isn't quite the case is
the nonsense
with being able to give names to the fields in a tuple (and
adding an alias
this to Tuple should be able to fix that). Being able to create
your own tuple
type which you can compare with Tuple simply because it happens
to hold the
same types is completely pointless as far as I can tell (but
you can still do
it if you really want to). If you want a tuple, then just use
std.typecons.Tuple. Creating another tuple type buys you
nothing.
- Jonathan M Davis
std.typecons.Tuple *is* a struct.
I agree with the above definition of tuples, but I want the
language to ensure that which at the moment it can't.