DIP19: Remove comma operator from D and provision better syntactic support for tuples
foobar
foo at bar.com
Thu Sep 27 02:49:22 PDT 2012
On Wednesday, 26 September 2012 at 23:02:45 UTC, Piotr Szturmaj
wrote:
> Jonathan M Davis wrote:
>> It sounds to me like the reason that structural typing is
>> needed is because
>> Tuple allows you to name its fields, which I've always thought
>> was a bad idea,
>> and which a built-in tuple definitely wouldn't do. If you
>> couldn't name its
>> fields, then any Tuple containing the same sequence of types
>> would be the same
>> type. So, the problem is caused by a feature that built-in
>> tuples wouldn't
>> even have.
>
> Exactly my PoV. I think that "tuples with named fields" should
> be anonymous structs and pure tuples shouldn't have named
> fields.
I agree.
Tuples do *not* have field names. (I'm also not sure they should
support slicing either).
structural compound types with field names are called "records"
in FP and they are a completely separate concept from tuples. We
really should not conflate the two and I agree that nameless
structs are the perfect vehicle to support record types.
One of D's strongest design decisions was to separate structs
from classes which is a huge win. Why do we want to go back on
that with regards to this very similar use case?
More information about the Digitalmars-d
mailing list