On 3/20/14, 6:52 PM, Steven Schveighoffer wrote:
On Thu, 20 Mar 2014 21:44:38 -0400, bearophile
<[email protected]> wrote:
Steven Schveighoffer:
This is also a pure function:
pure int foo()
{
while(1) {}
return 0;
}
Pure doesn't mean "bug free".
Thankfully the D compiler catches the bug :-)
test.d(3,4): Warning: statement is not reachable
I can make it not catch that error, but that is not the bug. The bug is
that it never returns, effectively deadlocking. The sample is
intentionally short to demonstrate my point, I (obviously) didn't try to
compile it.
-Steve
My dream: pure @safe functions never cause deadlock.
Andrei