August 03, 2013 Re: Template functions, can we make it more simple? | ||||
---|---|---|---|---|
| ||||
Posted in reply to monarch_dodra | monarch_dodra wrote:
> I'm not sure auto is the best choice of keywords, given potential clashes with auto ref:
>
> What if you want to pass a by ref?
> auto func(auto ref a, auto ref b) ?
> auto func(ref auto a, ref auto b) ?
>
> What if you want to pass them by *auto* ref?
> auto func(auto auto ref a, auto auto ref b) ?
> auto func(auto ref auto a, auto ref auto b) ?
>
> At this point, I'd really prefer just seeing classic template syntax...
Okay, so I mostly agree with this. I guess adding this change would mostly likely require a breaking change elsewhere, and I can see the merits of not doing anything like that for good while. Thanks for being so convincing.
|
August 10, 2013 Re: Template functions, can we make it more simple? | ||||
---|---|---|---|---|
| ||||
On Fri, Aug 02, 2013 at 04:29:39PM -0700, H. S. Teoh wrote: [...] > How would you translate this to the new syntax: > > class A(T,U) > { > T fun1(U x) { ... } > U fun2(T x) { ... } > V fun3(V)(V x) { ... } > auto fun4(T)(T x) { ... } > auto fun5(V)(T x, V y) { ... } > const(T) fun6(T x) { ... } > > T p; > T q; > U r; > U s; > } [...] Since no good answer is forthcoming, I'm forced to conclude that the new syntax is only marginally useful, and doesn't handle all the cases the current syntax can. So I don't think this change is worth the effort. T -- The computer is only a tool. Unfortunately, so is the user. -- Armaphine, K5 |
Copyright © 1999-2021 by the D Language Foundation