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
@noncopyable
types where the user is forced to call aconsuming
(andforget
ful) function likeclose() async throws
? Functions likeclose
cannot be synchronous in all systems, many systems require deregistration of a file descriptor from systems likekqueue
/epoll
before 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
deinit
for@noncopyable
structs/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 beenforget
ten before.