digitalmars.D.learn - D1->D2 member call syntax regression?
- Nick Sabalausky (16/16) Jul 27 2010 In converting some D1 code to D2, I noticed this doesn't seem to work
- Jonathan M Davis (5/24) Jul 27 2010 It looks more like a bug fix to me given that the first parameter to bar...
- bearophile (4/4) Jul 27 2010 It seems to work, on 2.042, and on dmd 2.047:
- Nick Sabalausky (13/17) Jul 27 2010 That's because my original example accidentally made Foo an uninstantiat...
- Nick Sabalausky (3/21) Jul 27 2010 The above also fails on 2.047
- bearophile (5/7) Jul 28 2010 Surely here there is no shortage of ways I can paint myself as a stupid ...
- Nick Sabalausky (4/12) Jul 28 2010 *I'm* the one that was dumb enough put them there in the first place! An...
- Nick Sabalausky (11/25) Jul 28 2010 It still leaves the question though, "Why isn't that working in D2? Bug ...
- Don (3/33) Jul 28 2010 It worked in 2.012 and earlier, but failed in 2.020. I don't have any
- Nick Sabalausky (4/22) Jul 28 2010 I've gone ahead and filed a bug report:
In converting some D1 code to D2, I noticed this doesn't seem to work anymore: module mymodule; class Foo() { void bar(string s) {...} void foo() { string str = "hello"; str.bar(); } } In D1 that works fine, but in D2 (2.047) it complains that it can't find "mymodule.bar". That's a bit dissapointing, as I keep hoping member call syntax will eventually get expanded, not reduced. Is this a bug, or is there some reason for it?
Jul 27 2010
On Tuesday, July 27, 2010 16:25:28 Nick Sabalausky wrote:In converting some D1 code to D2, I noticed this doesn't seem to work anymore: module mymodule; class Foo() { void bar(string s) {...} void foo() { string str = "hello"; str.bar(); } } In D1 that works fine, but in D2 (2.047) it complains that it can't find "mymodule.bar". That's a bit dissapointing, as I keep hoping member call syntax will eventually get expanded, not reduced. Is this a bug, or is there some reason for it?It looks more like a bug fix to me given that the first parameter to bar() is the invisible this rather than a string, but since I've never used D1, I certainly can't compare what it does to D2. - Jonathan M Davis
Jul 27 2010
It seems to work, on 2.042, and on dmd 2.047: http://ideone.com/dcsK3 Bye, bearophile
Jul 27 2010
"bearophile" <bearophileHUGS lycos.com> wrote in message news:i2nqs5$jss$1 digitalmars.com...It seems to work, on 2.042, and on dmd 2.047: http://ideone.com/dcsK3 Bye, bearophileThat's because my original example accidentally made Foo an uninstantiated class template, so the compiler never bothered to check the semantics... The following fails on 2.046 and 2.042, but works fine on 1.062: class Foo { void bar(string s) {} void foo() { string str = "hello"; str.bar(); } } void main() {}
Jul 27 2010
"Nick Sabalausky" <a a.a> wrote in message news:i2o9ev$1e4h$1 digitalmars.com..."bearophile" <bearophileHUGS lycos.com> wrote in message news:i2nqs5$jss$1 digitalmars.com...The above also fails on 2.047It seems to work, on 2.042, and on dmd 2.047: http://ideone.com/dcsK3 Bye, bearophileThat's because my original example accidentally made Foo an uninstantiated class template, so the compiler never bothered to check the semantics... The following fails on 2.046 and 2.042, but works fine on 1.062: class Foo { void bar(string s) {} void foo() { string str = "hello"; str.bar(); } } void main() {}
Jul 27 2010
Nick Sabalausky:That's because my original example accidentally made Foo an uninstantiated class template, so the compiler never bothered to check the semantics...Surely here there is no shortage of ways I can paint myself as a stupid :-) In Python the () after the class name are optional and they do nothing, so I didn't see them in that little D program :-) Bye, bearophile
Jul 28 2010
"bearophile" <bearophileHUGS lycos.com> wrote in message news:i2p4iq$po$1 digitalmars.com...Nick Sabalausky:*I'm* the one that was dumb enough put them there in the first place! And I can't use "extensive Python experience" as an excuse ;)That's because my original example accidentally made Foo an uninstantiated class template, so the compiler never bothered to check the semantics...Surely here there is no shortage of ways I can paint myself as a stupid :-) In Python the () after the class name are optional and they do nothing, so I didn't see them in that little D program :-)
Jul 28 2010
"Nick Sabalausky" <a a.a> wrote in message news:i2pvvi$2g83$1 digitalmars.com..."bearophile" <bearophileHUGS lycos.com> wrote in message news:i2p4iq$po$1 digitalmars.com...It still leaves the question though, "Why isn't that working in D2? Bug or legitimate reason?". Jonathan suggested it was deliberate because of the hidden "this" parameter, but I'm not convinced because 1) D1 has the hidden "this" param too, but it handles it just fine, and 2) It's just a syntactical issue, so I don't see how semantics could be a problem unless there's some other change in D2 that causes a conflict or ambiguity with that feature. In any case, the error message seems to indicate that, deliberate or not, it's likely some sort of symbol-lookup/visibility issue.Nick Sabalausky:*I'm* the one that was dumb enough put them there in the first place! And I can't use "extensive Python experience" as an excuse ;)That's because my original example accidentally made Foo an uninstantiated class template, so the compiler never bothered to check the semantics...Surely here there is no shortage of ways I can paint myself as a stupid :-) In Python the () after the class name are optional and they do nothing, so I didn't see them in that little D program :-)
Jul 28 2010
Nick Sabalausky wrote:"Nick Sabalausky" <a a.a> wrote in message news:i2pvvi$2g83$1 digitalmars.com...It worked in 2.012 and earlier, but failed in 2.020. I don't have any intermediate versions installed."bearophile" <bearophileHUGS lycos.com> wrote in message news:i2p4iq$po$1 digitalmars.com...It still leaves the question though, "Why isn't that working in D2? Bug or legitimate reason?". Jonathan suggested it was deliberate because of the hidden "this" parameter, but I'm not convinced because 1) D1 has the hidden "this" param too, but it handles it just fine, and 2) It's just a syntactical issue, so I don't see how semantics could be a problem unless there's some other change in D2 that causes a conflict or ambiguity with that feature. In any case, the error message seems to indicate that, deliberate or not, it's likely some sort of symbol-lookup/visibility issue.Nick Sabalausky:*I'm* the one that was dumb enough put them there in the first place! And I can't use "extensive Python experience" as an excuse ;)That's because my original example accidentally made Foo an uninstantiated class template, so the compiler never bothered to check the semantics...Surely here there is no shortage of ways I can paint myself as a stupid :-) In Python the () after the class name are optional and they do nothing, so I didn't see them in that little D program :-)
Jul 28 2010
"Don" <nospam nospam.com> wrote in message news:i2q0un$2hud$1 digitalmars.com...Nick Sabalausky wrote:I've gone ahead and filed a bug report: http://d.puremagic.com/issues/show_bug.cgi?id=4525It still leaves the question though, "Why isn't that working in D2? Bug or legitimate reason?". Jonathan suggested it was deliberate because of the hidden "this" parameter, but I'm not convinced because 1) D1 has the hidden "this" param too, but it handles it just fine, and 2) It's just a syntactical issue, so I don't see how semantics could be a problem unless there's some other change in D2 that causes a conflict or ambiguity with that feature. In any case, the error message seems to indicate that, deliberate or not, it's likely some sort of symbol-lookup/visibility issue.It worked in 2.012 and earlier, but failed in 2.020. I don't have any intermediate versions installed.
Jul 28 2010