Created
January 25, 2016 20:50
-
-
Save philip-wernersbach/6b79493b39da03b3b71e to your computer and use it in GitHub Desktop.
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
# Run with "nim cpp -r" | |
import asyncdispatch | |
# This doesn't work because the Nim compiler generates a goto that | |
# jumps into a try block. | |
# | |
# In C++ you can jump out of a try block, but not into it. In addition, | |
# jumping out of the try block here isn't valid behavior, because C++ | |
# will execute applicable destructors. | |
proc test() {.async.} = | |
var foo: pointer = nil | |
defer: | |
# In my real code, foo is a pointer to a non-GC variable that | |
# I have to ensure is freed | |
foo = nil | |
await sleepAsync(100) | |
asyncCheck test() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment