Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace open() & close() with failable init() + deinit #10

Closed
beltex opened this issue Dec 2, 2014 · 1 comment
Closed

Replace open() & close() with failable init() + deinit #10

beltex opened this issue Dec 2, 2014 · 1 comment

Comments

@beltex
Copy link
Owner

beltex commented Dec 2, 2014

  • Would make things simpler and cleaner
  • However, still a bit confused on deinit's behaviour
    • It's only called once the object is nil (no refs). Don't want to have to manually set it once done (might as well use close()). Neither do we want to use optional binding (it's a long lived object, gets repetitive). Want to use an implicitly unwrapped optional (due to the failable init()), but then deinit doesn't get called
    • What happens on program exit? Doesn't seem to be called. Want to still make sure that connection is closed. It's not a memory issue, OS X takes care of that on proc exit
@beltex
Copy link
Owner Author

beltex commented Jan 3, 2015

This no longer applies since SMC is now a struct, not a class. Even so, the general conclusion was that deinit() should not be relied on for such things. The Swift book seems to suggest it can nonetheless. If a new development comes along, we can look at this again. But it probably wouldn't be worth the performance trade-off anyway.

@beltex beltex closed this as completed Jan 3, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant