Infer function template parameters
Jonas Drewsen
jdrewsen at nospam.com
Fri Sep 21 12:10:11 PDT 2012
On Friday, 21 September 2012 at 11:40:54 UTC, Jonathan M Davis
wrote:
> 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.
Correct. The same with foreach where you also just save some
characters but it is darn nice anyway.
> 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.
Fair enough.
-Jonas
More information about the Digitalmars-d
mailing list