Avatar
Avatar
shiz
Task.initは特別ルールがあるらしく(現状のプロポーザルでは)、 Unstructured tasks created in nonisolated async functions do not capture the isolated parameter implicitly, and therefore do not inherit the isolation: https://github.com/hborla/swift-evolution/blob/async-function-isolation/proposals/NNNN-async-function-isolation.md#task-isolation-inheritance 理由としては、nonisolatedのsync関数と挙動を合わせるためだそうです。 This decision is deliberate to match the semantics of unstructured task creation in nonisolated synchronous functions. (edited)
で、思ったんですが https://github.com/hborla/swift-evolution/blob/async-function-isolation/proposals/NNNN-async-function-isolation.md#task-isolation-inheritance によって nonisolatedが暗黙のisolated actor: (any Actor)? = #isolation を持つとしたときに
Task.initは特別ルールがあるらしく(現状のプロポーザルでは)、 Unstructured tasks created in nonisolated async functions do not capture the isolated parameter implicitly, and therefore do not inherit the isolation:
って仕様は https://github.com/sophiapoirier/swift-evolution/blob/closure-isolation/proposals/nnnn-closure-isolation-control.md#isolation-inheritance@inheritsIsolationの仕様とバッティングしませんか?@inheritsIsolationでもTaskだけさらに挙動を上書きするってことですかね
(edited)