[dmd-beta] Fighting with 2.059 and not quite winning
Jonathan M Davis
jmdavisProg at gmx.com
Fri Apr 6 17:25:17 PDT 2012
On Friday, April 06, 2012 17:01:47 Vladimir Panteleev wrote:
> On Fri, 06 Apr 2012 07:39:42 +0300, Jonathan M Davis <jmdavisProg at gmx.com>
>
> wrote:
> > Okay. I don't know why you think that it's enforced. I just tried having
> > an
> > impure toString in both a struct and a class, and it worked just fine
> > for both.
>
> Ah, apparently I missed that it was actually a warning, sorry for that.
>
> Even so, now I need to choose whether to disable warnings in my project's
> build script (which is admittedly easier than calling casted method
> derferences everywhere) or find a way to solve these issues properly.
>
> Bug 7843 is related (-wi still prevents compilation when the new warnings
> are encountered).
But I always compile with -w, and I didn't hit any problems. I'll have to
check again...
Nope. It works just fine. For instance,
import std.stdio;
import std.conv;
import std.stdio;
struct S
{
int i;
string toString()
{
return to!string(i);
}
}
void main()
{
writeln(S(5));
}
compiles and runs perfectly with both -w and -wi. If I add pure to toString,
it'll fail, but it doesn't insist that toString be pure. The same goes with
classes. And I'm running the latest head (or a couple of commits behind, I
guess, since it looks like there were a couple of commits since last night,
when I updated last). So, I don't know why you're having problems. Could you
give code examples? I have no idea why you're seeing anything about pure being
required on toString.
- Jonathan M Davis
More information about the dmd-beta
mailing list