Skip to content

Description of sending in Flow-Sensitive Isolation Analysis needs more elaboration #123

@bjo0

Description

@bjo0

https://www.swift.org/migration/documentation/swift-6-concurrency-migration-guide/dataracesafety#Flow-Sensitive-Isolation-Analysis

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions