Andrei Alexandrescu, el 31 de marzo a las 18:50 me escribiste: > 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)?
Yes, even when that literal sucks =) > 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. This is all very nice theory, but in the practice, my 2 previos points stands. I'm sorry to keep quoting Python stuff, I agree pretty much with The Zen if Python (python -m this): Special cases aren't special enough to break the rules. Although practicality beats purity. =) -- Leandro Lucarella (luca) | Blog colectivo: http://www.mazziblog.com.ar/blog/ ---------------------------------------------------------------------------- GPG Key: 5F5A8D05 (F8CD F9A7 BF00 5431 4145 104C 949E BFB6 5F5A 8D05) ---------------------------------------------------------------------------- They love me like I was a brother They protect me, listen to me They dug me my very own garden Gave me sunshine, made me happy Nice dream, nice dream Nice dream