December 31, 2009 Re: dmd 1.054 and 2.038 release | ||||
---|---|---|---|---|
| ||||
Posted in reply to Don | On Thu, 31 Dec 2009 15:05:56 -0500, Don <nospam@nospam.com> wrote:
> bearophile wrote:
>> Walter Bright:
>>> Happy New Year!
>> Happy end of the year to you too!
>> Is this the last release for the 2009? ;-)
>> This is funny:
>> min(x, y) = 10; // sets x to 10
>> This looks by far like the most useful improvement/change of this DMD release, I've already tried it and I like it a lot, thanks to Don and to you!
>>> Bugzilla 2816: Sudden-death static assert is not very useful<
>
> I can't take credit for that. It comes from the LDC guys, I just enhanced it slightly.
> There are 26 Bugzilla votes fixed in this release, which is probably a record. (I'm assuming bug 1961('scoped const') is considered to be fixed).
Sadly, it's not fixed yet :(
struct S
{
int x;
inout(int)* getX() inout { return &x;}
}
void main()
{
S s;
int *x = s.getX();
}
testinout.d(10): Error: function testinout.S.getX () inout is not callable using argument types ()
testinout.d(10): Error: cannot implicitly convert expression (s.getX()) of type inout(int)* to int*
It appears the auto-conversion is not happening on the return, and also the call isn't working.
I'm surprised this was listed as an implemented feature... Is there some test code that you were using to confirm this Walter?
-Steve
|
December 31, 2009 Re: dmd 1.054 and 2.038 release | ||||
---|---|---|---|---|
| ||||
Posted in reply to bearophile | bearophile wrote: > grauzone: >> But I have a problem: the compiler is either extremely slow for me, or is stuck in an endless loop. All it does is to slowly allocate memory. I aborted the compilation after ~ 20 minutes and 2 GB RAM allocation. This wasn't the case with dmd 1.053, where it only took 5-10 seconds to compile. >> Can anyone confirm this? > > Show the code! I was going to say "but it's hundreds of modules", but then I tried to compile some other big hog of code: Tango. And I found compiling this file hangs: http://dsource.org/projects/tango/browser/trunk/tango/core/tools/Demangler.d?rev=5248 The exact command line for this was: dmd -c -I../tango/core -I.. -I../tango/core/vendor -release -oftango-core-tools-Demangler-release.o ../tango/core/tools/Demangler.d Again, could anyone confirm this? Anyway, no time for this anymore, it's going to be 2010 soon here. > Bye, > bearophile |
December 31, 2009 Re: dmd 1.054 and 2.038 release | ||||
---|---|---|---|---|
| ||||
Posted in reply to Walter Bright | "Walter Bright" <newshound1@digitalmars.com> wrote in message news:hhirlb$fj0$1@digitalmars.com... > Happy New Year! > > http://www.digitalmars.com/d/1.0/changelog.html http://ftp.digitalmars.com/dmd.1.054.zip > > > http://www.digitalmars.com/d/2.0/changelog.html http://ftp.digitalmars.com/dmd.2.038.zip > > Many thanks to the numerous people who contributed to this update. Improved static assert messages and a few forward reference fixes == Awesome! |
December 31, 2009 Re: dmd 1.054 and 2.038 release | ||||
---|---|---|---|---|
| ||||
Posted in reply to Steven Schveighoffer | Steven Schveighoffer wrote:
>>(I'm assuming bug 1961('scoped const') is considered to be
>> fixed).
>
> Sadly, it's not fixed yet :(
>
>
> struct S
> {
> int x;
> inout(int)* getX() inout { return &x;}
> }
>
> void main()
> {
> S s;
> int *x = s.getX();
> }
>
>
> testinout.d(10): Error: function testinout.S.getX () inout is not callable using argument types ()
> testinout.d(10): Error: cannot implicitly convert expression (s.getX()) of type inout(int)* to int*
>
> It appears the auto-conversion is not happening on the return, and also the call isn't working.
The inout on the return has to be at the top level, as in inout(int *). This probably needs improvement.
|
January 01, 2010 Re: dmd 1.054 and 2.038 release | ||||
---|---|---|---|---|
| ||||
Posted in reply to Steven Schveighoffer | Steven Schveighoffer Wrote: > struct S > { > int x; > inout(int)* getX() inout { return &x;} > } > > void main() > { > S s; > int *x = s.getX(); > } > > > testinout.d(10): Error: function testinout.S.getX () inout is not callable using argument types () That's the same error message as http://d.puremagic.com/issues/show_bug.cgi?id=3642 Does that error message ever pop up in a meaningful context??? > testinout.d(10): Error: cannot implicitly convert expression (s.getX()) of type inout(int)* to int* At least in this case, there are other error messages that give a strong hint to what the real cause is. I'm still crossing my fingers that 3642 can be improved in some way. |
January 01, 2010 Re: dmd 1.054 and 2.038 release | ||||
---|---|---|---|---|
| ||||
Posted in reply to Walter Bright | On Thu, 31 Dec 2009 16:20:08 -0500, Walter Bright <newshound1@digitalmars.com> wrote:
> Steven Schveighoffer wrote:
>>> (I'm assuming bug 1961('scoped const') is considered to be fixed).
>> Sadly, it's not fixed yet :(
>> struct S
>> {
>> int x;
>> inout(int)* getX() inout { return &x;}
>> }
>> void main()
>> {
>> S s;
>> int *x = s.getX();
>> }
>> testinout.d(10): Error: function testinout.S.getX () inout is not callable using argument types ()
>> testinout.d(10): Error: cannot implicitly convert expression (s.getX()) of type inout(int)* to int*
>> It appears the auto-conversion is not happening on the return, and also the call isn't working.
>
> The inout on the return has to be at the top level, as in inout(int *). This probably needs improvement.
Yes, this is an important distinction.
With your recommended change, the error is now:
testinout.d(4): Error: inout on return means inout must be on a parameter as well for inout inout(int*)()
inout doesn't seem to work with ref either. The only thing I could get to work is this:
struct S
{
int x;
}
inout(int *) getSX(inout S* s) { return &s.x;}
void main()
{
S s;
const(S)* sp = &s;
int *x = getSX(&s);
//int *y = getSX(sp); // uncomment this line for an error
const(int) *y = getSX(sp);
}
If you uncomment the designated line, the error reads:
testinout.d(13): Error: cannot implicitly convert expression (getSX(sp)) of type const(int*) to int*
which looks good.
-Steve
|
January 01, 2010 Re: dmd 1.054 and 2.038 release | ||||
---|---|---|---|---|
| ||||
Posted in reply to Steven Schveighoffer | Steven Schveighoffer wrote:
> The only thing I could get to work is this:
>
>
> struct S
> {
> int x;
> }
>
> inout(int *) getSX(inout S* s) { return &s.x;}
>
> void main()
> {
> S s;
> const(S)* sp = &s;
> int *x = getSX(&s);
> //int *y = getSX(sp); // uncomment this line for an error
> const(int) *y = getSX(sp);
> }
>
> If you uncomment the designated line, the error reads:
>
> testinout.d(13): Error: cannot implicitly convert expression (getSX(sp))
> of type const(int*) to int*
>
> which looks good.
The error looks misleading to me. The error is with the input argument to the function, not the return type.
|
January 01, 2010 Re: dmd 1.054 and 2.038 release | ||||
---|---|---|---|---|
| ||||
Posted in reply to grauzone | On Thu, 31 Dec 2009 21:03:25 +0100, grauzone wrote:
> Walter Bright wrote:
>> Happy New Year!
>>
>> http://www.digitalmars.com/d/1.0/changelog.html http://ftp.digitalmars.com/dmd.1.054.zip
>>
>>
>> http://www.digitalmars.com/d/2.0/changelog.html http://ftp.digitalmars.com/dmd.2.038.zip
>>
>> Many thanks to the numerous people who contributed to this update.
>
> Tons of bug fixes == great!
>
> But I have a problem: the compiler is either extremely slow for me, or is stuck in an endless loop. All it does is to slowly allocate memory. I aborted the compilation after ~ 20 minutes and 2 GB RAM allocation. This wasn't the case with dmd 1.053, where it only took 5-10 seconds to compile.
>
> Can anyone confirm this?
I just stumbled over the problem compiling Tango trunk with dmd 1.054. It works on Windows.
|
January 01, 2010 Re: dmd 1.054 and 2.038 release | ||||
---|---|---|---|---|
| ||||
Posted in reply to Steven Schveighoffer | Steven Schveighoffer wrote:
> On Thu, 31 Dec 2009 16:20:08 -0500, Walter Bright <newshound1@digitalmars.com> wrote:
>
>> Steven Schveighoffer wrote:
>>>> (I'm assuming bug 1961('scoped const') is considered to be fixed).
>>> Sadly, it's not fixed yet :(
>>> struct S
>>> {
>>> int x;
>>> inout(int)* getX() inout { return &x;}
>>> }
>>> void main()
>>> {
>>> S s;
>>> int *x = s.getX();
>>> }
>>> testinout.d(10): Error: function testinout.S.getX () inout is not callable using argument types ()
>>> testinout.d(10): Error: cannot implicitly convert expression (s.getX()) of type inout(int)* to int*
>>> It appears the auto-conversion is not happening on the return, and also the call isn't working.
>>
>> The inout on the return has to be at the top level, as in inout(int *). This probably needs improvement.
>
> Yes, this is an important distinction.
>
> With your recommended change, the error is now:
>
> testinout.d(4): Error: inout on return means inout must be on a parameter as well for inout inout(int*)()
>
> inout doesn't seem to work with ref either. The only thing I could get to work is this:
>
>
> struct S
> {
> int x;
> }
>
> inout(int *) getSX(inout S* s) { return &s.x;}
>
> void main()
> {
> S s;
> const(S)* sp = &s;
> int *x = getSX(&s);
> //int *y = getSX(sp); // uncomment this line for an error
> const(int) *y = getSX(sp);
> }
>
> If you uncomment the designated line, the error reads:
>
> testinout.d(13): Error: cannot implicitly convert expression (getSX(sp)) of type const(int*) to int*
>
> which looks good.
>
> -Steve
Well I'm sorry to tell that inout is useless as currently implemented. One important motivating use case was:
inout(char)[] blah(inout(char)[] input) {
return input;
}
void main()
{
blah("xyz");
blah("xyz".dup);
}
That doesn't work at all. The second motivating case also doesn't work:
class A {
A _next;
inout A next() inout { return _next; }
}
void main()
{
auto a = new A;
const b = a;
auto c = a.next();
auto d = b.next();
}
There are few, if any, cases where the current inout does help. The good news is that most of the implementation effort has been done so probably making things work will not be very difficult.
Andrei
|
January 01, 2010 Re: dmd 1.054 and 2.038 release | ||||
---|---|---|---|---|
| ||||
Posted in reply to grauzone | On Thu, 31 Dec 2009 21:22:58 +0100, grauzone wrote: > bearophile wrote: >> grauzone: >>> But I have a problem: the compiler is either extremely slow for me, or is stuck in an endless loop. All it does is to slowly allocate memory. I aborted the compilation after ~ 20 minutes and 2 GB RAM allocation. This wasn't the case with dmd 1.053, where it only took 5-10 seconds to compile. Can anyone confirm this? >> >> Show the code! > > I was going to say "but it's hundreds of modules", but then I tried to compile some other big hog of code: Tango. > > And I found compiling this file hangs: http://dsource.org/projects/tango/browser/trunk/tango/core/tools/ Demangler.d?rev=5248 > > The exact command line for this was: > dmd -c -I../tango/core -I.. -I../tango/core/vendor -release > -oftango-core-tools-Demangler-release.o ../tango/core/tools/Demangler.d > > Again, could anyone confirm this? > > Anyway, no time for this anymore, it's going to be 2010 soon here. > >> Bye, >> bearophile Someone reported the regression already: http://d.puremagic.com/issues/show_bug.cgi?id=3663 |
Copyright © 1999-2021 by the D Language Foundation