Skip to content

Instantly share code, notes, and snippets.

@gcr
Created January 11, 2014 01:28
Show Gist options
  • Select an option

  • Save gcr/8365804 to your computer and use it in GitHub Desktop.

Select an option

Save gcr/8365804 to your computer and use it in GitHub Desktop.
type
Tx=object
foo: string
proc destruct*(x: var Tx) {.destructor.}=
echo "Destructing "&x.foo
proc main_broken() =
var y = Tx(foo:"y")
var z = Tx(foo:"z")
proc main_works() =
var
y = Tx(foo:"y")
z = Tx(foo:"z")
main_broken()
echo "-------"
main_works()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment