On Thursday, 12 July 2018 at 19:07:15 UTC, Luís Marques wrote:
Consider a D REPL session like this:

Unlike cling, drepl doesn't seem to support overloading:

Welcome to D REPL.
D> import std.stdio;
std
D> void bar(long) { writeln("long"); }
bar
D> void bar(int) { writeln("int"); }
bar
D> bar(42)
`_mod2.bar` at /tmp/drepl.adse9Q/_mod2.d(3) conflicts with `_mod1.bar` at /tmp/drepl.adse9Q/_mod1.d(3) template `std.stdio.write` cannot deduce function from argument types `!()(void)`, candidates are: /usr/include/dmd/phobos/std/stdio.d(3669): `std.stdio.write(T...)(T args) if (!is(T[0] : File))`

It can envision the implementation that produces that result, and in terms of that implementation it makes sense, but ouch, that's not user friendly or in-line with regular D semantics.

Reply via email to