Template functions, can we make it more simple?

F i L witte2008 at gmail.com
Fri Aug 2 17:51:19 PDT 2013


I've brought this up on here awhile ago, and many people seemed 
to be against it. Which I don't agree with, since the ambiguities 
it creates are easily addressed (from a design perspective at 
least) and only exist so that C-style code is usable within D. It 
could work like:

    auto func(a, b)     // auto func(A, B)(A a, B b)
    auto func(int a, b) // auto func(B)(int a, B b)
    auto func(int ?)    // C-style: auto func(int)

Or...

    auto func(auto a, auto b) // like C++14

I mean honestly, who's hand-writing a bunch of functions with 
nameless params in real D code? Sure it's used for linking to C, 
which is semi-common, but I think having the much cleaner syntax 
available to "actual" D code makes more sense that not having it 
solely for linking-to-C-in-familiar-C-style reasons.


More information about the Digitalmars-d mailing list