Re: Pure Contract bug? (unnecessarily strict)

2012-01-30 Thread Jesse Phillips

On Sunday, 29 January 2012 at 06:22:26 UTC, Era Scarecrow wrote:
Maybe someone's brought this up, but i seem to have the 
compiler complaining to me that my function isn't 'pure' by 
calling a non-pure function, specifically to!string().


I don't see why this couldn't be done, not only does it get not 
exist in release, it shouldn't be changing variables in 
non-release. As mentioned there is a hole for debug code.


Report it:

http://d.puremagic.com/issues/

and we'll see what happens with that.


Re: Pure Contract bug? (unnecessarily strict)

2012-01-30 Thread Era Scarecrow
I don't see why this couldn't be done, not only does it get not 
exist in release, it shouldn't be changing variables in 
non-release. As mentioned there is a hole for debug code.


Report it:

http://d.puremagic.com/issues/

and we'll see what happens with that.


Reported; Minor priority (Won't break code)

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


Pure Contract bug? (unnecessarily strict)

2012-01-28 Thread Era Scarecrow
 Maybe someone's brought this up, but i seem to have the compiler complaining 
to me that my function isn't 'pure' by calling a non-pure function, 
specifically to!string().

 However the unpure functions are only accessed in the contracts, and only if 
it failed seriously. Is this already planned to be worked on? I thought i read 
the contracts shouldn't be considered as part of it since they are totally 
excluded during the release builds (and shouldn't have any side effects). 

Error: pure function 'offset' cannot call impure function 'to'


@property const pure int offset(int field)
in {
assert(field  notes.length);
}
out (o) {
assert(o = 0, Negative value! Check structure: ~ name ~ 
\nReq: ~ requ ~ \nsize: ~ to!string(size) ~ \n);
}
body { ... }



Re: Pure Contract bug? (unnecessarily strict)

2012-01-28 Thread Daniel Murphy
The way to avoid purity checking is to put code in a debug {} statement. 
I'm not aware of any plans to disable purity checking for contracts.