Re: pure vs writeln debugging
Jesse Phillips wrote in message news:vaatltklsmbmdnabo...@forum.dlang.org... Wish it would work with @safe and nothrow too, granted writeln should eventually be @safe/trusted anyway. I just travelled back in time and granted your wish! int x; int* p; void main() pure nothrow @safe { debug x = 3; debug throw new Exception(null); debug *(p+7) = 2; }
Re: pure vs writeln debugging
On Tuesday, 11 February 2014 at 07:52:57 UTC, Daniel Murphy wrote: Jesse Phillips wrote in message news:vaatltklsmbmdnabo...@forum.dlang.org... Wish it would work with @safe and nothrow too, granted writeln should eventually be @safe/trusted anyway. I just travelled back in time and granted your wish! int x; int* p; void main() pure nothrow @safe { debug x = 3; debug throw new Exception(null); debug *(p+7) = 2; } I guess I wasn't clear, when I compile with -debug I should be able to use writeln in an @safe/nothrow function just as it is with pure.
Re: pure vs writeln debugging
On Sunday, 9 February 2014 at 00:18:28 UTC, Nick Sabalausky wrote: On 2/8/2014 5:30 PM, Adam D. Ruppe wrote: On Saturday, 8 February 2014 at 22:27:39 UTC, Nick Sabalausky wrote: Is there some way to poke enough of a hole in pure to get some writeln debugging statements in? literally write debug writeln(..) abnd it should work in the pure function Nice! So I take it purity enforcement is disabled with the -debug flag? Or is it some sort of hack with writeln? It is a compiler benefit. Wish it would work with @safe and nothrow too, granted writeln should eventually be @safe/trusted anyway.
Re: pure vs writeln debugging
On Saturday, 8 February 2014 at 22:27:39 UTC, Nick Sabalausky wrote: Is there some way to poke enough of a hole in pure to get some writeln debugging statements in? literally write debug writeln(..) abnd it should work in the pure function
pure vs writeln debugging
Is there some way to poke enough of a hole in pure to get some writeln debugging statements in?
Re: pure vs writeln debugging
On 2/8/2014 5:30 PM, Adam D. Ruppe wrote: On Saturday, 8 February 2014 at 22:27:39 UTC, Nick Sabalausky wrote: Is there some way to poke enough of a hole in pure to get some writeln debugging statements in? literally write debug writeln(..) abnd it should work in the pure function Nice! So I take it purity enforcement is disabled with the -debug flag? Or is it some sort of hack with writeln?
Re: pure vs writeln debugging
On Sunday, 9 February 2014 at 00:18:28 UTC, Nick Sabalausky wrote: So I take it purity enforcement is disabled with the -debug flag? Or is it some sort of hack with writeln? The debug statement specifically (which is only compiled in when you use the -debug flag). debug foo(); will work in a pure function, even if foo is not pure.