digitalmars.D.learn - pure vs writeln debugging
- Nick Sabalausky (2/2) Feb 08 2014 Is there some way to poke enough of a hole in "pure" to get some writeln...
- Adam D. Ruppe (5/7) Feb 08 2014 literally write
- Nick Sabalausky (4/10) Feb 08 2014 Nice!
- Adam D. Ruppe (5/7) Feb 08 2014 The debug statement specifically (which is only compiled in when
- Jesse Phillips (4/18) Feb 09 2014 It is a compiler benefit.
- Daniel Murphy (11/13) Feb 10 2014 I just travelled back in time and granted your wish!
- Jesse Phillips (4/17) Feb 11 2014 I guess I wasn't clear, when I compile with -debug I should be
Is there some way to poke enough of a hole in "pure" to get some writeln debugging statements in?
Feb 08 2014
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
Feb 08 2014
On 2/8/2014 5:30 PM, Adam D. Ruppe wrote:On Saturday, 8 February 2014 at 22:27:39 UTC, Nick Sabalausky wrote:Nice! So I take it purity enforcement is disabled with the -debug flag? Or is it some sort of hack with writeln?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
Feb 08 2014
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.
Feb 08 2014
On Sunday, 9 February 2014 at 00:18:28 UTC, Nick Sabalausky wrote:On 2/8/2014 5:30 PM, Adam D. Ruppe wrote:It is a compiler benefit. Wish it would work with safe and nothrow too, granted writeln should eventually be safe/trusted anyway.On Saturday, 8 February 2014 at 22:27:39 UTC, Nick Sabalausky wrote:Nice! So I take it purity enforcement is disabled with the -debug flag? Or is it some sort of hack with writeln?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
Feb 09 2014
"Jesse Phillips" wrote in message news:vaatltklsmbmdnabojip 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; }
Feb 10 2014
On Tuesday, 11 February 2014 at 07:52:57 UTC, Daniel Murphy wrote:"Jesse Phillips" wrote in message news:vaatltklsmbmdnabojip forum.dlang.org...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.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; }
Feb 11 2014