I very much support this proposal, I think I'm waiting for it for over 5 years now
.
I have two pieces of feedback:
-
Can we make sure that is is possible to write
@available(*, unavailable) deinit { preconditionFailure("the impossible happened") }To be able to have
@noncopyabletypes where the user is forced to call aconsuming(andforgetful) function likeclose() async throws? Functions likeclosecannot be synchronous in all systems, many systems require deregistration of a file descriptor from systems likekqueue/epollbefore being able to actually close thefd. Alsoclose(2)can block so in some cases it may be wise to do so off the Swift Concurrency cooperative pool. -
I'm not in love with reusing the word
deinitfor@noncopyablestructs/enums. I'm sure we can find a word that makes it clearer what's going on and that it is not run when it has beenforgetten before.