On 2008-12-10 20:17:54 -0500, "Bill Baxter" <[email protected]> said:
someFunction(x, y) {
return x+y;
}
addone(x) {
val result; /*inferred-type result (in proposed language)*/
result = someFunction(x,1);
return result;
}
Isn't the following already working in D2?
(I don't have a D2 compiler at hand right now to check)
auto someFunction(X, Y)(X x, Y y) {
return x+y;
}
auto addone(X)(X x) {
auto result = someFunction(x, 1);
return result;
}
I agree that the syntax can be improved; I already suggested using
"auto" for argument types to create function templates, which would
give:
auto someFunction(auto x, auto y) {
return x+y;
}
auto addone(auto x) {
auto result = someFunction(x, 1);
return result;
}
--
Michel Fortin
[email protected]
http://michelf.com/