Const Tuples
Dicebot via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Fri Apr 25 08:06:21 PDT 2014
On Friday, 25 April 2014 at 13:18:13 UTC, bearophile wrote:
> Dicebot:
>
>> It would be weird exception of general type system rules with
>> no practical justification I can readily imagine.
>
> I partially disagree. It could be useful to have structural
> typing (http://en.wikipedia.org/wiki/Structural_type_system )
> only on tuples (and not on structs), because the formal
> definition of tuple goes well with structural typing. This also
> implies the type equivalence of const tuple with a tuple of
> const fields.
>
> Bye,
> bearophile
Again, you refer to some sort of formal definition of tuple which
is not applicable to D. We don't have real tuples in D. There are
structures that emulate some of tuple properties and there is a
built-in feature that is called tuple but is not one in practice.
For your objections to make sense tuple would need to be
inroduced as completely new first class type system entity. As
this will never happen, discussion of imaginary "proper" tuple
traits is also unapplicable.
More information about the Digitalmars-d-learn
mailing list