-
Notifications
You must be signed in to change notification settings - Fork 29
Description
The text on it is as follows:
Region-based isolation works without any code changes. But a function’s parameters and return values can also explicitly state that they support crossing domains using this mechanism.
func populate(island: Island, with chicken: sending Chicken) async {
await island.adopt(chicken)
}
The compiler can now provide the guarantee that at all call sites, the chicken parameter will never be subject to unsafe access. This is a relaxing of an otherwise significant constraint. Without sending, this function would only be possible to implement by requiring that Chicken first conform to Sendable.
Based on this, I don't feel like I understand how to reason about using sending
. Is the compiler still going to guarantee safety, or is this a foot gun? If it still guarantees safety, how is it any different than omitting sending
? Another sentence or two, or a reference to a more detailed explanation, would be helpful.