Created
August 13, 2014 15:31
-
-
Save jovial/588a336c9d2b52992e38 to your computer and use it in GitHub Desktop.
SIGSEGV with nimrod finializers and echo
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type | |
AObj = object | |
b : BRef | |
BObj = object | |
i : int | |
ARef = ref AObj | |
BRef = ref BObj | |
proc finalize(a : ARef) = | |
echo "A has gone" | |
proc finalize(b: BRef) = | |
echo "B has gone" | |
for i in 0..500: | |
var | |
b : BRef | |
a : ARef | |
new(b, finalize) | |
b.i = 2 | |
new(a,finalize) | |
a.b = b | |
assert(a.b.i == 2) | |
# weird behaviour with echo a.b.i | |
echo a.b.i | |
echo "done" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment