Andrej Mitrovic , dans le message (digitalmars.D.learn:30315), a écrit : > The new one: https://gist.github.com/1194497 > > I'll investigate this further then.
OK, so there is indeed a filter to find a suitable delegate to load: @trusted T connect(T)(T handler) if(isHandler!(T, Types)); But only the first Bar.x function is picked and given to isHandler!(T, int) to check it can be called. Bar.x(double) do not pass this filter. I guess if the signature were: T connect(void handler(Types)); T connect(bool handler(Types)); etc... or maybe T connect(T : void handler(Types)) (T handler); T connect(T : bool handler(Types)) (T handler); etc... Then the compiler should be able to select the right Bar.x method. But with the isHandler filter,it is not able to find it. I don't see a way to improve isHandler to make it able to find the right Bar.x method, without modification of the compiler*, but I am not an expert here. * the compiler should allow all overloads of a function given as a template argument to be tested against the filter to choose the right one, and complain if several overloads match the filter. -- Christophe
