D1->D2 member call syntax regression?

2010-07-27 Thread Nick Sabalausky
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?




Re: D1->D2 member call syntax regression?

2010-07-27 Thread Jonathan M Davis
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


Re: D1->D2 member call syntax regression?

2010-07-27 Thread bearophile
It seems to work, on 2.042, and on dmd 2.047:
http://ideone.com/dcsK3

Bye,
bearophile


Re: D1->D2 member call syntax regression?

2010-07-27 Thread Nick Sabalausky
"bearophile"  wrote in message 
news:i2nqs5$js...@digitalmars.com...
> It seems to work, on 2.042, and on dmd 2.047:
> http://ideone.com/dcsK3
>
> Bye,
> bearophile

That'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() {} 




Re: D1->D2 member call syntax regression?

2010-07-27 Thread Nick Sabalausky
"Nick Sabalausky"  wrote in message 
news:i2o9ev$1e4...@digitalmars.com...
> "bearophile"  wrote in message 
> news:i2nqs5$js...@digitalmars.com...
>> It seems to work, on 2.042, and on dmd 2.047:
>> http://ideone.com/dcsK3
>>
>> Bye,
>> bearophile
>
> That'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() {}

The above also fails on 2.047 




Re: D1->D2 member call syntax regression?

2010-07-28 Thread bearophile
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


Re: D1->D2 member call syntax regression?

2010-07-28 Thread Nick Sabalausky
"bearophile"  wrote in message 
news:i2p4iq$p...@digitalmars.com...
> 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 :-)
>

*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 ;)




Still unresolved (Was: D1->D2 member call syntax regression?)

2010-07-28 Thread Nick Sabalausky
"Nick Sabalausky"  wrote in message 
news:i2pvvi$2g8...@digitalmars.com...
> "bearophile"  wrote in message 
> news:i2p4iq$p...@digitalmars.com...
>> 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 :-)
>>
>
> *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 ;)
>

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.




Re: Still unresolved (Was: D1->D2 member call syntax regression?)

2010-07-28 Thread Don

Nick Sabalausky wrote:
"Nick Sabalausky"  wrote in message 
news:i2pvvi$2g8...@digitalmars.com...
"bearophile"  wrote in message 
news:i2p4iq$p...@digitalmars.com...

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 :-)


*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 ;)




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.



It worked in 2.012 and earlier, but failed in 2.020. I don't have any 
intermediate versions installed.


Re: Still unresolved (Was: D1->D2 member call syntax regression?)

2010-07-28 Thread Nick Sabalausky
"Don"  wrote in message 
news:i2q0un$2hu...@digitalmars.com...
> Nick Sabalausky wrote:
>>
>> 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.
>>
>>
> It worked in 2.012 and earlier, but failed in 2.020. I don't have any 
> intermediate versions installed.

I've gone ahead and filed a bug report:

http://d.puremagic.com/issues/show_bug.cgi?id=4525