Overall, I am +1 on this proposal.
One thing I did notice reading the proposal is that the words 'transfer' and 'transferring' are used 24 times (not including the table of contents) including ten uses of variants of the phrases ātransfer across concurrent boundariesā or ātransfer across concurrency domainsā.
That phrase is cited as part of the key question in the Motivation section and the summary of the purpose of the proposal in the Conclusion.
Outside of mentions of Sendable
and @sendable
, the word āsendā or its derivatives only appear five times in the proposal.
- Twice āsendā is used as a noun: āactor message sendā
- Twice it is used paired with āreceiveā (send/receive, sender/receiver)
- Only once is it used to describe wanting to āsend bits of computation between concurrency domainsā
The proposal text itself favors the term ātransferā to āsendā as the best way to describe passing values between concurrency domains.
To me, that indicates that Transferable
and @transferable
may be better names for the protocol and attribute.
Two comparative drawbacks I can think of to this name are that it is three characters longer and some people will probably want to spell it with two ārās.
A few other points from reading the proposal:
I also noticed that of five mentions of the word āsend/senderā in the proposal text, two of them are paired with āreceive/receiverā. In this proposal, a value that is āsendableā is also implied to be āreceivableā. A value that is ātransferrableā explicitly acknowledges both sides of the transfer.
The examples Iāve found of types that mention one side of an operation tend to be paired with the other side, such as Encodable
/Decodable
and Foundationās InputStream
/OutputStream
. It does seem a little odd that many things will be Sendable
but nothing is Receivable
.
For me Transferable
better describes the entirety of the operation. It marks something I can transfer from one context to another.
And although I realize proposal review should not focus strongly on the follow-on work mentioned in the proposal, I think itās important to note that the naming decided on in this proposal will set precedent for the naming of future related types.
For instance, I would say that the naming of the UnsafeTransfer
property wrapper described in the Future Work / Follow-on Projects section is an excellent, descriptive name.
With the protocol name Transferable
, it follows that something transferable is part of a transfer. Something that is not marked as transferable would need to be part of an unsafe transfer. Types and APIs can refer to transfers and transferable values and they fit in the same family of names for related functionality.
The analogous type, I suppose, would be an UnsafeSend
where send is used as a noun and not a verb. Iāve typically not heard āsendā used as a noun on its own, but in a phrase like āmessage sendā. Of course, this property wrapper would not be an UnsafeMessageSend
because the message isnāt unsafe, it is the value. So it could be an UnsafeValueSend
.
I think most would agree that UnsafeTransfer
would be a better name than UnsafeValueSend
, but using that name the developer now needs to associate āsendableā with ātransferā.
Conclusion
Based on simply the names themselves, I find Transferable
to be more descriptive and preferable to Sendable
.
For me an even stronger argument for Transferable
over Sendable
is that it opens things up for much clearer naming of follow-on types and API, with the clear association of a ātransferā with ātransferableā.