Leandro Lucarella wrote:
Andrei Alexandrescu, el 31 de marzo a las 17:57 me escribiste:
Agree. They should be first class citizen as dynamic arrays or hashes.
Why? Not grokking it.

It's perfectly explained in this thread why, all I have to say will
repeate something already said (the int[] vs. std::vector<int> mostly). Of
course you don't seem to agree with those arguments...

Well I don't agree, but maybe there's more arguments that could improve that.

If they are not 1st citizens you just end up:
1) not using them
2) making your code look like boost, I mean *really* ugly ;)
   (when what you want to do it's even possible, of course)


Tuple is a 1st citizen language constituent (they have to). It just doesn't have a literal. Say we do invent a literal, e.g.:

[: int, float :] mytuple;

Does this improve the language over Tuple!(int, float)? I'm not convinced - at all, in fact. Right now Tuple is on equal footing with other templates and whatever introspection we have/will add works/will work on Tuple as it works with other templates. With the extra syntax, we'll then need to add special methods for introspecting a tuple. We'll find ourselves also reserving a keyword "tuple" and positing that [: ... :] is the same as tuple!(...) or some other similarly unpleasant solution. Plus, special syntax contributes to the disconnect between user-defined and built-in. This creates the self-perpetuating trend that if anything is interesting, it should have a literal allocated to it. Instead of that, let's think e.g. of methods to generally make parameterized types look better.


Andrei

Reply via email to