Const Tuples

Dicebot via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Fri Apr 25 06:09:38 PDT 2014


On Friday, 25 April 2014 at 12:54:25 UTC, bearophile wrote:
> Dicebot:
>
>> std.typecons.Tuple is just a subset of all structs 
>> implementing specific behavior. It still acts as struct 
>> everywhere when applicable.
>
> A subset is not the same as the whole set.
>
> You are missing something important about what a data structure 
> is. Take a look at your computer science books.
>
> Another example: a dynamic array allows several operations, 
> including append at the end and pop from the end. If I define a 
> Stack data structure based on a dynamic array with just its 
> pop/append/empty/length operations, I have defined a new data 
> structure.
>
> Bye,
> bearophile

I am not interested in academic definitions. D is not an academic 
language (thanks gods!) and expecting it to prioritize formal 
concepts over mundane pragmatism only leads to frustration. The 
fact that you can use D rules to emulate certain concept as a 
user-defined type does not make domain semantics of that type 
more important than language. It is still a second-class citizen.

You don't change language rules by creating new data structures. 
Type system still must prevail :)


More information about the Digitalmars-d-learn mailing list