On 9/26/12, Michael Matz <m...@suse.de> wrote: > On Tue, 25 Sep 2012, Lawrence Crowl wrote: > > On 8/15/12, Richard Henderson <r...@redhat.com> wrote: > > > On 2012-08-15 07:29, Richard Guenther wrote: > > > > typedef typename Element::Element_t Element_t; > > > > > > Can we use something less ugly than Element_t? > > > Such as typedef typename Element::T T; > > > ? Given that this name is scoped anyway... > > > > I've been finding the use of T as a typedef confusing. > > Why? As type placeholder in templates it's quite customary, > as the "most interesting to users of this template". I would > have no trouble at all to see declarations like "T x = getme();" > in a function. In some way I even prefer that to some lower-case > variant, because it reminds me that this specific "T" is actually > variant.
The problem is that while T is customary as a template parameter, I have never seen it used as a typedef name. And that's the situation that we are in now. > A lower-case type name indicates to me a non-changing type, > i.e. nothing that depends on a template. In C we only had > such types so we used lower-case names everywhere. With C++ > and templates I think we should start using upper case for some > very specific use cases, like first letter of dependend types. How would you distinguish them from template parameter names, which by convention have an upper case first letter? What about non-type dependent names? I think we really do need a separate convention for the two, because dependent members of class templates often need special access syntax. > > It sort of flies in the face of all existing convention. > > If you talk about the conventions used for the c++ standard > library, then they are IMHO quite ugly and we should not follow > them. The advantage to following them is that they will surprise no one. Do you have an alternate suggestion, one that does not confuse template parameters and dependent names? -- Lawrence Crowl