Recently one of the most important bugs was mostly fixed, beside
Win64 support this is one of the most important changes in dmd
2.061:
http://d.puremagic.com/issues/show_bug.cgi?id=6036
Do you think this has to be correct code?
struct Adder {
int v;
int opCall(int x) { return x + v; }
}
void main() {
auto a = Adder(5);
}
Bye,
bearophile

Recently one of the most important bugs was mostly fixed, beside
Win64 support this is one of the most important changes in dmd
2.061:
http://d.puremagic.com/issues/show_bug.cgi?id=6036
Do you think this has to be correct code?
struct Adder {
int v;
int opCall(int x) { return x + v; }
}
void main() {
auto a = Adder(5);
}

I would argue that that should compile, but it wouldn't surprise me at all if
it doesn't - especially because of the stupidity that makes it so that you can
call static functions with member instances, muddying the differences between
static and non-static in terms of how you call them. And the fact that you
can't overload a function as static and non-static (probably due to the
aforementioned nonsense) just makes it worse. So, much as this _should_ work
IMHO, it doesn't surprise me at all if it doesn't.
- Jonathan M Davis

Recently one of the most important bugs was mostly fixed, beside Win64 support
this is one of the most important changes in dmd 2.061:
http://d.puremagic.com/issues/show_bug.cgi?id=6036
Do you think this has to be correct code?
struct Adder {
int v;
int opCall(int x) { return x + v; }
}
void main() {
auto a = Adder(5);
}

Yes, with resulting a.v==5.
This should result in an int == 42:
auto a = Adder(37)(5);
'static' either needs to be handled properly or another op needs to be
introduced - opStaticCall(). Which might look like a hack, but doing it
like that may be simpler to implement and relatively harmless (as the
aggregate.op* namespace has to be treated as reserved in practice).
Also, the type and instance methods shouldn't form an overload set, so
separating them is a good idea (a matching non-static opCall must always
take precedence).
Calling the static-opCall (either opStaticCall or the "normal" 'static
opCall', if/when that one works properly) with an instance should work.
(not doing this would need changes to how the null-checking is done
and likely cause other problems that i can't think of right now)
artur

Recently one of the most important bugs was mostly fixed, beside Win64
support this is one of the most important changes in dmd 2.061:
http://d.puremagic.com/issues/show_bug.cgi?id=6036
Do you think this has to be correct code?
struct Adder {
int v;
int opCall(int x) { return x + v; }
}
void main() {
auto a = Adder(5);
}
Bye,
bearophile