≈ the.bay.news

[Pitch #2] Called-once function types

Swift Forums
[Pitch #2] Called-once function types
Hello Swift Evolution! This is the second pitch for a language feature that lets you annotate function types as executing exactly once or at most once: func callOnce(_ c: @once () -> Void) { c() c() // error: 'c' is consumed more than once } Read the full proposal in this pull request. The motivation for this feature is to give the compiler enough information to let closures passed to certain APIs consume values of noncopyable types and re-send values of non-Sendable types. Today, code t...

Hello Swift Evolution! This is the second pitch for a language feature that lets you annotate function types as executing exactly once or at most once: func callOnce(_ c: @once…

0 comments

Sign in to join the discussion — your thebay.events account works here.

No comments yet.