Skip to content

Instantly share code, notes, and snippets.

@chadaustin
Created November 28, 2016 20:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chadaustin/b6901f11e7669dac9a01491fbd7498d0 to your computer and use it in GitHub Desktop.
Save chadaustin/b6901f11e7669dac9a01491fbd7498d0 to your computer and use it in GitHub Desktop.
var count: Int = 1234
class C {
init() {
myThing = count
count += 1
Swift.print("🇺🇸 Entry")
}
deinit {
C.theGlobal = self
Swift.print("🇺🇸 Exit")
}
let myThing: Int
static var theGlobal: C = C()
}
func main() {
{
_ = C()
}()
Swift.print(C.theGlobal.myThing)
}
main()
🇺🇸 Entry
🇺🇸 Entry
🇺🇸 Exit
🇺🇸 Exit
139638667215401
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment