Does D have too many features?
Andrej Mitrovic
andrej.mitrovich at gmail.com
Sun Apr 29 13:49:19 PDT 2012
On 4/29/12, Alex Rønne Petersen <xtzgzorex at gmail.com> wrote:
> I hate to nitpick and all that, but opBinaryRight!"in" actually works
> now. ;)
Yes and then you get to have those nice template instantiation errors,
which make no sense at all:
struct Foo {
auto opIn_r(string op)(int i) { return 1; }
}
struct Bar {
auto opBinaryRight(string op)(int i) { return 1; }
}
void main()
{
Foo foo;
auto x = "" in foo;
Bar bar;
auto y = "" in bar;
}
Foo:
test.d(34): Error: template test.Foo.opIn_r does not match any
function template declaration
test.d(16): Error: template test.Foo.opIn_r(string op) cannot deduce
template function from argument types !()(string)
Bar:
test.d(37): Error: rvalue of in expression must be an associative array, not Bar
The Bar error message is completely useless.
More information about the Digitalmars-d
mailing list