Infer function template parameters

Jonathan M Davis jmdavisProg at gmx.com
Fri Sep 21 04:21:38 PDT 2012


On Friday, September 21, 2012 13:14:56 Jonas Drewsen wrote:
> Maybe I wasn't clear in my suggestion. The new syntax in simply a
> way to define a templated function - not a non-templated one ie:
> 
> auto foo(a,b) {}
> is exactly the same as
> auto foo(A,B)(A a, B b) {}

So all it does is save you a few characters? I don't think that that's even 
vaguely worth it. It complicates the language and doesn't add any 
functionality whatsoever.

And when you consider that it then makes it _harder_ to quickly see that a 
function is templated, and it potentially makes it easier to accidentally 
templatize a function, I think that it's a net loss even without considering 
the fact that it complicates the language further. And _with_ considering it, 
I think that it's definitely more trouble than it's worth.

- Jonathan M Davis


More information about the Digitalmars-d mailing list