3 ms·
Two issues with using is that 1. Its restricted to functions, you cant have an IDisposable member without having to implement IDisposable yourself and there ma
by Too 9y ago
Two issues with using is that
1. Its restricted to functions, you cant have an IDisposable member without having to implement IDisposable yourself and there manually close the member. Just allowing an annotation on the variable would have made this so much more ergonomic.
2. The lack of ownership semantics when passing objects as function arguments makes it hard to reason about the program. There is no difference between temporary borrowed reference, ownership transfer and shared ownership so you never know if you are the one that should call close or if one of the functions did or will do in the future.