On Sat, Aug 03, 2013 at 01:03:36AM +0200, SteveGuo wrote: > >I like this syntax. > > > >I'm worried, though, about how it will interact with explicit > >template parameters. E.g., how would you express this: > > > > bool func(R,T,U)(T t, U u) { ... } > > > >in the new syntax? > > > > bool func(R)(auto t, auto u) { ... } > > > >? > > > >What if we have variadics on either side? > > > >I'm still on the fence as to whether we should add the new syntax, > >nice as it is. The current syntax is far more unambiguous, and allows > >you to specify signature constraints on the input types directly, as > >well as use it in the return type spec, without needing to say > >typeof(t) or typeof(u). > > > > > >T > > If these syntax is feasible to template functions, is it possible to > apply it to class template? > > class A > { > int a; // normal member > auto b; // template member? > }
I think that's a bad idea. It's too ambiguous. What will you do with template member functions? class A { auto b(auto c) { ... } } What are the template parameters of A? I still think the current syntax is better. It's a little more verbose in some cases, but I think that's not a big deal. After having used D templates for a while now, the syntax is actually very comfortable to use. I think this kind of cosmetic change is not worth the effort (and potential breakage) at this point in time. T -- A computer doesn't mind if its programs are put to purposes that don't match their names. -- D. Knuth