Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.
Sign upFinalize conventions for `close` #26
Comments
This comment has been minimized.
This comment has been minimized.
|
In this case also the 'close' name may not be descriptive enough, since we're not just closing a resource, but deleting it. |
This comment has been minimized.
This comment has been minimized.
|
@brson so |
This comment has been minimized.
This comment has been minimized.
|
Seems just |
This comment has been minimized.
This comment has been minimized.
|
@opilar So the issue here is that sometimes it's appropriate to close a resource explicitly, and not let it implicitly drop. Usually this is to handle an error condition, which drop doesn't allow. Types in std don't generally have close methods, but they should, and the conventions aren't decided, so for this issue we need to decide what we want such 'close' conventions to be, and whether the existing method here conforms to them. Design question. Not sure how to resolve it, but it probably needs to be a broader discussion elsewhere. cc @dtolnay |
This comment has been minimized.
This comment has been minimized.
|
Yep, this came up during our |
This comment has been minimized.
This comment has been minimized.
|
Still no clear guidelines. |
This comment has been minimized.
This comment has been minimized.
|
I believe the current definition of I don't think there is any reasonable case for retrying a failed close here. |
This comment has been minimized.
This comment has been minimized.
|
I posted a longer comment on the tracking issue, but I'd personally still feel that |
This comment has been minimized.
This comment has been minimized.
|
@alexcrichton's comments in the linked thread about favoring |
opilar
pushed a commit
to opilar/tempdir
that referenced
this issue
Sep 22, 2017
This comment has been minimized.
This comment has been minimized.
|
When combining the We still haven't reached much consensus in rust-lang-nursery/api-guidelines#61, but can continue the discussion there about the general merits of different approaches to checked teardown. Thanks all! |
brson commentedMar 28, 2017
There's no precedent in std for this, and there's been suggestion that the current signature is not correct (preferring
&mut selftoself).