digitalmars.D - opCall/ctor partially sorted out
- bearophile (14/14) Oct 06 2012 Recently one of the most important bugs was mostly fixed, beside
- Jonathan M Davis (9/25) Oct 06 2012 I would argue that that should compile, but it wouldn't surprise me at a...
- Adam D. Ruppe (3/4) Oct 06 2012 I think it should work, but I'd call it a minor bug if it doesn't
- Andrej Mitrovic (2/10) Oct 06 2012 opCall isn't static so there's no ambiguity here imo.
- Artur Skawina (16/30) Oct 07 2012 Yes, with resulting a.v==5.
- bearophile (4/8) Oct 07 2012 Next important bug to focus on is (in my top5 bug list):
- deadalnix (2/15) Oct 07 2012 opCall isn't static here. So it shouldn't be involved.
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
Oct 06 2012
On Sunday, October 07, 2012 04:24:33 bearophile wrote: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
Oct 06 2012
On Sunday, 7 October 2012 at 02:36:31 UTC, bearophile wrote:Do you think this has to be correct code?I think it should work, but I'd call it a minor bug if it doesn't because it isn't hard to work around.
Oct 06 2012
On 10/7/12, bearophile <bearophileHUGS lycos.com> wrote: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); }opCall isn't static so there's no ambiguity here imo.
Oct 06 2012
On 10/07/12 04:24, bearophile wrote: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
Oct 07 2012
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=6036Next important bug to focus on is (in my top5 bug list): http://d.puremagic.com/issues/show_bug.cgi?id=3789 Bye, bearophile
Oct 07 2012
Le 07/10/2012 04:24, bearophile a écrit :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, bearophileopCall isn't static here. So it shouldn't be involved.
Oct 07 2012