On 07/03/13 18:24, H. S. Teoh wrote: > On Wed, Jul 03, 2013 at 06:07:07PM +0200, Artur Skawina wrote: >> The context dependence isn't ideal, but what's the alternative?... > [...] > > Explicit syntax for specifying overloads? ;-) Not like that would happen > in D, though.
Real Programmers need no special syntax :) import std.stdio; void foo(int a){ writeln("overload int"); } void foo(long b){ writeln("overload long"); } auto pickOverload(alias FP, A...)() @property { typeof(FP(A.init)) function(A) fp = &FP; return fp;} void main() { auto b = pickOverload!(foo, long); b(2); } But using the context to automatically figure out the right overload make some things easier; it's just that eg the lhs of an assignment affecting the result of the rhs-expression doesn't /feel/ right. artur