Slide 1

Slide 1 text

S_Shimotori AsyncSequenceͱ
 AsyncStreamͷϓϩϙʔβϧΛ
 શ෦ಡΉʂʂ kanagawa.swift #2

Slide 2

Slide 2 text

S_Shimotori • Kotlin Festͷํ޲͔Βདྷ·ͨ͠ • ਆಸ઒ཁૉɿͳ͍ɻɻ • ΞϧϑΝϕοςΟΧϑΣ͞Μʹ͸
 ͍͔ͭߦ͖͍ͨ☕

Slide 3

Slide 3 text

എܠ

Slide 4

Slide 4 text

Concurrencyؔ࿈ͷproposalશ෦ಡΉ͔ʙ • Synchronizationͷཧղʹ͸΍͸ΓConcurrencyͷ׬શͳཧղ͕ෆՄܽͩΑͳʙ • Swift Evolution͔ΔͨͰࢂഊͨ͘͠ͳ͍͠ͳʙ • ࣾ಺ษڧձͰຖ݄1ຊͣͭൃදͯ͠΍Ζʙ

Slide 5

Slide 5 text

ͤͬͤͱൃදʂʢࣾ಺Ͱʣ • ະެ։ࢿྉ

Slide 6

Slide 6 text

ऴΘΒͶʙʙ

Slide 7

Slide 7 text

ղܾࡦɿಡΉϖʔεͱൃදͷϖʔεΛ্͛Δ • AsyncSequenceͱAsyncStreamΛҰؾಡΈͩʂ • ͔Δͨڧऀͷਆಸ઒ݝຽͷօ͞ΜͳΒ࿩Λฉ͍ͯ͘Εͦ͏

Slide 8

Slide 8 text

ຊ೔ͷϓϩϙʔβϧ

Slide 9

Slide 9 text

ଟ͍ʙ • SE-0298 Async/Await: Sequences • SE-0314 AsyncStream and AsyncThrowingStream • SE-0388 Convenience Async[Throwing]Stream.makeStream methods • SE-0406 Backpressure support for AsyncStream • SE-0421 Generalize e ff ect polymorphism for AsyncSequence and AsyncIteratorProtocol • SE-0468 Hashable conformance for Async(Throwing)Stream.Continuation

Slide 10

Slide 10 text

࿩͢͜ͱ • ࿩͢͜ͱ • S_ShimotoriͷউखͳಡΈ৺஍ϨϏϡʔɹ˒˒˒ ⭐︎ ⭐︎ • S_Shimotori͕໘ന͍ͱࢥͬͨ࿩ • ࿩͞ͳ͍͜ͱ • AsyncSequenceͱAsyncStreamͷ࢖͍ํ

Slide 11

Slide 11 text

΍͍ͬͯͥ͘ʂ • SE-0298 Async/Await: Sequences • SE-0314 AsyncStream and AsyncThrowingStream • SE-0388 Convenience Async[Throwing]Stream.makeStream methods • SE-0421 Generalize e ff ect polymorphism for AsyncSequence and AsyncIteratorProtocol • SE-0468 Hashable conformance for Async(Throwing)Stream.Continuation

Slide 12

Slide 12 text

΍͍ͬͯͥ͘ʂ • SE-0298 Async/Await: Sequences • SE-0314 AsyncStream and AsyncThrowingStream • SE-0388 Convenience Async[Throwing]Stream.makeStream methods • SE-0421 Generalize e ff ect polymorphism for AsyncSequence and AsyncIteratorProtocol • SE-0468 Hashable conformance for Async(Throwing)Stream.Continuation

Slide 13

Slide 13 text

SE-0298 Async/Await: Sequences

Slide 14

Slide 14 text

SE-0298 • https://github.com/swiftlang/swift-evolution/blob/main/proposals/0298- asyncsequence.md • Swift 5.5ʢ2021೥ʣ • iOS 13.0΁ͷόοΫϙʔτ͋Γ • λΠτϧ΍ϑΝΠϧ໊ͷ௨ΓAsyncSequenceͷ࿩ https://developer.apple.com/documentation/Swift/AsyncSequence

Slide 15

Slide 15 text

͜Εͷ͜ͱͰ͢ʂ • ͳΜ͔Α͘for awaitจͰ͙Δ͙Δճ͞ΕͯΔ΍ͭ for try await line in myFile.lines() { // Do something with each line } https://developer.apple.com/documentation/Swift/AsyncSequence ͜Ε

Slide 16

Slide 16 text

SE-0298ϨϏϡʔʢʁʣ ೉қ౓ ˒ˑˑˑˑ લఏͷSE-0296ΛࠐΈͰߟ͑Δͱ ͪΐͬͱCSͷ஌͕ࣝඞཁ ௕͞ ˒ˑˑˑˑ .md্Ͱ͸362ߦ
 ͘͢͝୹ͯ͘ಡΈ΍͍͕͢ɺ಺༰͸૬Ԡʹബ͍ ॏཁ౓ ˒ˑˑˑˑ ਎͕ۙͩɺಡ·ͳͯ͘΋ੜ͖͍͚ͯΔ

Slide 17

Slide 17 text

SE-0298 Introductionͷ༁ • Swiftͷasync/awaitػೳ͸ɺ͍͔ͭকདྷͷ͋Δ࣌఺Ͱ୯Ұͷ஋Λฦؔ͢਺Λॻ ͍ͨΓ࢖ͬͨΓ͢ΔͨΊͷɺ௚ײత͔ͭϏϧτΠϯͷํ๏Λఏڙ͍ͯ͠Δɻ • զʑ͸ɺ࣌ؒͷܦաͱͱ΋ʹෳ਺ͷ஋Λฦؔ͢਺Λॻ͍ͨΓ࢖ͬͨΓ͢Δͨ Ίͷ௚ײత͔ͭϏϧτΠϯͷํ๏Λ࡞੒͢ΔͨΊɺ͜ͷػೳΛϕʔεʹங͘͜ ͱΛఏҊ͢Δɻ 👇SE-0296 Async/await 👆SE-0296 Async/await

Slide 18

Slide 18 text

SE-0296 Async/awaitʢલఏͷϓϩϙʔβϧʣ • ͍͔ͭকདྷͷ͋Δ࣌఺Ͱ୯Ұͷ஋Λฦ͢ let dataResource = try await loadWebResource("dataprofile.txt") https://github.com/swiftlang/swift-evolution/blob/main/proposals/0296-async-await.md

Slide 19

Slide 19 text

SE-0298 Async/Await: Sequences • ࣌ؒͷܦաͱͱ΋ʹෳ਺ͷ஋Λฦ͢ for try await line in myFile.lines() { // Do something with each line } https://github.com/swiftlang/swift-evolution/blob/main/proposals/0298-asyncsequence.md

Slide 20

Slide 20 text

ײ૝ • SE-0296 Async/awaitΛಡΜͩ΄͏͕͍͍ • ͜Μͳਓʹ͓͢͢Ί • AsyncSequenceΛ࢖͍͗ͯ͢ເʹग़͖ͯͨਓ

Slide 21

Slide 21 text

΍͍ͬͯͥ͘ʂ • SE-0298 Async/Await: Sequences ✅ • SE-0314 AsyncStream and AsyncThrowingStream • SE-0388 Convenience Async[Throwing]Stream.makeStream methods • SE-0421 Generalize e ff ect polymorphism for AsyncSequence and AsyncIteratorProtocol • SE-0468 Hashable conformance for Async(Throwing)Stream.Continuation

Slide 22

Slide 22 text

SE-0314
 AsyncStream and AsyncThrowingStream

Slide 23

Slide 23 text

SE-0314 • https://github.com/swiftlang/swift-evolution/blob/main/proposals/0314- async-stream.md • Swift 5.5ʢ2021೥ʣ • iOS 13.0΁ͷόοΫϙʔτ͋Γ • λΠτϧ΍ϑΝΠϧ໊ͷ௨ΓAsyncStreamͷ࿩ https://developer.apple.com/documentation/Swift/AsyncStream

Slide 24

Slide 24 text

SE-0314ϨϏϡʔʢʁʣ ೉қ౓ ˒ˑˑˑˑ AsyncStreamΛ࢖ͬͨ͜ͱ͕͋Ε͹ಡΊΔ CS஌ࣝ΋΄΅ෆཁ ௕͞ ˒˒ˑˑˑ .md্Ͱ͸554ߦ
 ιʔείʔυ͕ଟ͍ͷͰ௕͘͸ײ͡ͳ͍͔΋ ॏཁ౓ ˒ˑˑˑˑ ਎ۙͳଘࡏ……ͳͷ͔ͳ͋

Slide 25

Slide 25 text

AsyncStreamΛ࡞Δํ๏ • init(_:bufferingPolicy:_:) • init(unfolding:onCancel:) • makeStream(of:bufferingPolicy:)

Slide 26

Slide 26 text

AsyncStreamΛ࡞Δํ๏ • init(_:bufferingPolicy:_:) • init(unfolding:onCancel:) • makeStream(of:bufferingPolicy:) 👈 SE-0388Ͱޙ͔Β௥Ճ

Slide 27

Slide 27 text

init(_:bufferingPolicy:_:) class QuakeMonitor { var quakeHandler: ((Quake) -> Void)? func startMonitoring() { ... } func stopMonitoring() { ... } static var quakes: AsyncStream { AsyncStream { continuation in let monitor = QuakeMonitor() monitor.quakeHandler = { quake in continuation.yield(quake) } continuation.onTermination = { @Sendable _ in monitor.stopMonitoring() } monitor.startMonitoring() } } } https://developer.apple.com/documentation/Swift/AsyncStream ͜Ε

Slide 28

Slide 28 text

SE-0314 Introductionͷ༁ • SE-0300Ͱ௥Ճ͞Εͨܧଓܕ͸ɺσϦήʔτϝιου΍ίʔϧόοΫؔ਺ͷݺ ͼग़͠ʹΑΓ׬ྃΛ௨஌͢Δಉظίʔυʹରͯ͠Ξμϓλʔͱͯ͠ػೳ͢Δɻ • ͦͷ୅ΘΓʹ࣌ؒͷܦաͰෳ਺ͷ஋Λੜ੒͢Δίʔυʹରͯ͠͸ɺ͜ͷఏҊ ͕AsyncSequenceΠϯλʔϑΣʔεͷ࣮૷Λαϙʔτ͢ΔͨΊͷ৽͍͠ܕΛ ௥Ճ͢Δɻ

Slide 29

Slide 29 text

SE-0314 Introductionͷ༁ • SE-0300Ͱ௥Ճ͞Εͨܧଓܕ͸ɺσϦήʔτϝιου΍ίʔϧόοΫؔ਺ͷݺ ͼग़͠ʹΑΓ׬ྃΛ௨஌͢Δಉظίʔυʹରͯ͠Ξμϓλʔͱͯ͠ػೳ͢Δɻ • ͦͷ୅ΘΓʹ࣌ؒͷܦաͰෳ਺ͷ஋Λੜ੒͢Δίʔυʹରͯ͠͸ɺ͜ͷఏҊ ͕AsyncSequenceΠϯλʔϑΣʔεͷ࣮૷Λαϙʔτ͢ΔͨΊͷ৽͍͠ܕΛ ௥Ճ͢Δɻ

Slide 30

Slide 30 text

ܧଓ……ʁ https://developer.apple.com/documentation/swift/withcheckedcontinuation(isolation:function:_:) func withCheckedContinuation( isolation: isolated (any Actor)? = #isolation, function: String = #function, _ body: (CheckedContinuation) -> Void ) async -> sending T

Slide 31

Slide 31 text

Continuationͩʂ • withCheckedContinuation { continuation in } ͬͯ΍ͭ func withCheckedContinuation( _ body: (CheckedContinuation) -> Void ) async -> sending T https://developer.apple.com/documentation/swift/withcheckedcontinuation(isolation:function:_:)

Slide 32

Slide 32 text

ܧଓ……ʁ class QuakeMonitor { var quakeHandler: ((Quake) -> Void)? func startMonitoring() { ... } func stopMonitoring() { ... } static var quakes: AsyncStream { AsyncStream { continuation in let monitor = QuakeMonitor() monitor.quakeHandler = { quake in continuation.yield(quake) } continuation.onTermination = { @Sendable _ in monitor.stopMonitoring() } monitor.startMonitoring() } } } https://developer.apple.com/documentation/Swift/AsyncSequence

Slide 33

Slide 33 text

class QuakeMonitor { var quakeHandler: ((Quake) -> Void)? func startMonitoring() { ... } func stopMonitoring() { ... } static var quakes: AsyncStream { AsyncStream { continuation in let monitor = QuakeMonitor() monitor.quakeHandler = { quake in continuation.yield(quake) } continuation.onTermination = { @Sendable _ in monitor.stopMonitoring() } monitor.startMonitoring() } } } AsyncStream { continuation in continuation.yield(quake) continuation.onTermination = { } } Continuationͩʂ https://developer.apple.com/documentation/Swift/AsyncSequence AsyncStream.Continuation

Slide 34

Slide 34 text

AsyncStream.Continuation • ಉظίʔυͱඇಉظίʔυؒΛ݁ͼ͚ͭΔػߏɻ • init(_:bufferingPolicy:_:)ͰAsyncStreamʹ౉ͨ͠Ϋϩʔδϟ͸ɺ ݺͼग़͞ΕΔͱ͜ͷܕͷΠϯελϯεΛड͚औΔɻ͜ͷܧଓΛ࢖ͬͯɺyield ϝιουͷ͍ͣΕ͔ΛݺͿ͜ͱͰετϦʔϜʹཁૉΛ౉͠ɺfinish()ϝιο υΛݺͿ͜ͱͰετϦʔϜΛਖ਼ৗʹऴྃ͢Δɻ • SwiftͷଞͷܧଓͱҟͳΓɺAsyncStream.Continuation͸ΤεέʔϓΛα ϙʔτ͢Δɻ https://developer.apple.com/documentation/swift/asyncstream/continuation

Slide 35

Slide 35 text

AsyncSequenceͱAsyncStreamͷཱͪҐஔ 1. Swiftʹඇಉظؔ਺Λಋೖ͠ɺ୯Ұͷ஋ΛฦͤΔΑ͏ʹ͢ΔʢSE-0296ʣ 2. SwiftʹAsyncSequenceΛಋೖ͠ɺ࣌ؒܦաͰෳ਺ͷ஋ΛฦͤΔΑ͏ʹ͢ΔʢSE-0298ʣ 3. withCheckedContinuationʢSE-0300ʣ͸1౓͚ͩ׬ྃΛ௨஌͠ɺ
 ಉظؔ਺ͱඇಉظؔ਺ͷڮ౉͠Λ୲͏ • ͦΕΛ࣮ݱ͢ΔͨΊʹܧଓΛ࢖͍ͬͯΔ 4. AsyncStreamʢSE-0314ʣ͸ෳ਺ճʹΘͨͬͯ஋Λ௨஌͠ɺ
 ಉظؔ਺ͱඇಉظؔ਺ͷڮ౉͠Λ୲͏ • ͦΕΛ࣮ݱ͢ΔͨΊʹܧଓͱAsyncSequenceΛ࢖͍ͬͯΔ

Slide 36

Slide 36 text

AsyncSequenceͱAsyncStreamͷཱͪҐஔ 1. Swiftʹඇಉظؔ਺Λಋೖ͠ɺ୯Ұͷ஋ΛฦͤΔΑ͏ʹ͢ΔʢSE-0296ʣ 2. SwiftʹAsyncSequenceΛಋೖ͠ɺ࣌ؒܦաͰෳ਺ͷ஋ΛฦͤΔΑ͏ʹ͢ΔʢSE-0298ʣ 3. withCheckedContinuationʢSE-0300ʣ͸1౓͚ͩ׬ྃΛ௨஌͠ɺ
 ಉظؔ਺ͱඇಉظؔ਺ͷڮ౉͠Λ୲͏ • ͦΕΛ࣮ݱ͢ΔͨΊʹܧଓΛ࢖͍ͬͯΔ 4. AsyncStreamʢSE-0314ʣ͸ෳ਺ճʹΘͨͬͯ஋Λ௨஌͠ɺ
 ಉظؔ਺ͱඇಉظؔ਺ͷڮ౉͠Λ୲͏ • ͦΕΛ࣮ݱ͢ΔͨΊʹܧଓͱAsyncSequenceΛ࢖͍ͬͯΔ

Slide 37

Slide 37 text

AsyncStreamΛ࡞Δํ๏ʢ࠶ܝʣ • init(_:bufferingPolicy:_:) 👈 ܧଓΛ࢖͏ • init(unfolding:onCancel:) • makeStream(of:bufferingPolicy:) 👈 SE-0388Ͱޙ͔Β௥Ճ

Slide 38

Slide 38 text

AsyncStreamΛ࡞Δํ๏ʢ࠶ܝʣ • init(_:bufferingPolicy:_:) 👈 ܧଓΛ࢖͏ • init(unfolding:onCancel:) • makeStream(of:bufferingPolicy:) 👈 SE-0388Ͱޙ͔Β௥Ճ

Slide 39

Slide 39 text

init(unfolding:onCancel:) • () async -> Element?Λड͚औͬͯޙ͸Α͠ͳʹ΍ͬͯ͘ΕΔ΍ͭ • ͜ͷΠχγϟϥΠβ͸ΫϩʔδϟΛ”ల։”ͯ͠ඇಉظετϦʔϜʹ͢Δɻ࡞੒ ͞ΕͨετϦʔϜ͸ɺऴྃॲཧʢΩϟϯηϧ͢Δ͔൓෮ॲཧͷऴྃͷͨΊʹ Ϋϩʔδϟ͔ΒnilΛฦ͢ʣ΋ؚΊͯAsyncSequenceϓϩτίϧ΁ࣗಈతʹ ४ڌ͢Δɻ https://developer.apple.com/documentation/swift/asyncstream/init(unfolding:oncancel:)

Slide 40

Slide 40 text

init(unfolding:onCancel:) • () async -> Element?Λड͚औͬͯޙ͸Α͠ͳʹ΍ͬͯ͘ΕΔ΍ͭ • ͜ͷΠχγϟϥΠβ͸ΫϩʔδϟΛ”ల։”ͯ͠ඇಉظετϦʔϜʹ͢Δɻ࡞੒ ͞ΕͨετϦʔϜ͸ɺऴྃॲཧʢΩϟϯηϧ͢Δ͔൓෮ॲཧͷऴྃͷͨΊʹ Ϋϩʔδϟ͔ΒnilΛฦ͢ʣ΋ؚΊͯAsyncSequenceϓϩτίϧ΁ࣗಈతʹ ४ڌ͢Δɻ https://developer.apple.com/documentation/swift/asyncstream/init(unfolding:oncancel:) unfold

Slide 41

Slide 41 text

Haskellͷunfolding • unfoldr :: (b -> Maybe (a, b)) -> b -> [a] • SwiftͰॻ͘ͱ
 func unfoldr(f: (U) -> (T, U)?, seed: U) -> [T] • SwiftͬΆ͘આ໌͢Δͱ
 Ϋϩʔδϟ͸γʔυ஋seedΛड͚औΓɺArrayͷੜ੒͕׬͍ྃͯ͠Ε͹nil Λฦ͢ɻͦ͏Ͱͳ͚Ε͹(t, u)Λฦ͠ɺt͸Arrayͷઌ಄ʹ௥Ճ͞Εɺu͸࣍ ͷ࠶ؼݺͼग़͠Ͱ࢖͏γʔυ஋ͱͳΔɻ • c.f. HaskellͷfoldrɺSwiftͷreduce(_:_:) https://hackage.haskell.org/package/base-4.21.0.0/docs/Data-List.html#v:unfoldr

Slide 42

Slide 42 text

AsyncStreamΛ࡞Δํ๏ʢ࠶ܝʣ • init(_:bufferingPolicy:_:) 👈 ܧଓΛ࢖͏ • init(unfolding:onCancel:) 👈 ΫϩʔδϟΛ”ల։”͢Δ • makeStream(of:bufferingPolicy:) 👈 SE-0388Ͱޙ͔Β௥Ճ

Slide 43

Slide 43 text

ײ૝ • SE-0300ΛಡΜͩ΄͏͕ͨΊʹͳΓͦ͏ • ݁ߏڍಈ͕΍΍͍͜͠Β͍͠ɻɻ • ͜Μͳਓʹ͓͢͢Ί • Continuation͕޷͖ͳਓ • AsyncStreamΛ࢖͍͗ͯ͢ເʹग़͖ͯͨਓ https://zenn.dev/kntk/articles/0001fdd2a4f76d

Slide 44

Slide 44 text

΍͍ͬͯͥ͘ʂ • SE-0298 Async/Await: Sequences ✅ • SE-0314 AsyncStream and AsyncThrowingStream ✅ • SE-0388 Convenience Async[Throwing]Stream.makeStream methods • SE-0421 Generalize e ff ect polymorphism for AsyncSequence and AsyncIteratorProtocol • SE-0468 Hashable conformance for Async(Throwing)Stream.Continuation

Slide 45

Slide 45 text

SE-0388 Convenience Async[Throwing]Stream.makeStream methods

Slide 46

Slide 46 text

SE-0388 • https://github.com/swiftlang/swift-evolution/blob/main/proposals/0388- async-stream-factory.md • Swift 5.9ʢ2023೥ʣ • iOS 13.0΁ͷόοΫϙʔτ͋Γ • AsyncStreamͷmakeStream(of:bufferingPolicy:)ͷ࿩ https://developer.apple.com/documentation/swift/asyncstream/makestream(of:bu ff eringpolicy:)

Slide 47

Slide 47 text

͜Εͷ͜ͱͰ͢ʂ let (stream, continuation) = AsyncStream.makeStream(of: Int.self) await withTaskGroup(of: Void.self) { group in group.addTask { for i in 0...9 { continuation.yield(i) } continuation.finish() } group.addTask { for await i in stream { print(i) } } } ͜Ε

Slide 48

Slide 48 text

SE-0388ϨϏϡʔʢʁʣ ೉қ౓ ˒ˑˑˑˑ ʢAsyncʣStreamΛ࢖ͬͨ͜ͱ͕͋Ε͹ಡΊΔ CS஌ࣝෆཁ ௕͞ ˒ˑˑˑˑ .md্Ͱ͸164ߦ ͢ʙʙʙͬ͘͝୹͍ʂ ॏཁ౓ ˒ˑˑˑˑ ͋Μ·Γɻɻ

Slide 49

Slide 49 text

class QuakeMonitor { var quakeHandler: ((Quake) -> Void)? func startMonitoring() { ... } func stopMonitoring() { ... } static var quakes: AsyncStream { AsyncStream { continuation in let monitor = QuakeMonitor() monitor.quakeHandler = { quake in continuation.yield(quake) } continuation.onTermination = { @Sendable _ in monitor.stopMonitoring() } monitor.startMonitoring() } } } AsyncStream { continuation in continuation.yield(quake) continuation.onTermination = { } } Continuationͩʂʢ࠶ʣ https://developer.apple.com/documentation/Swift/AsyncSequence

Slide 50

Slide 50 text

AsyncStream.Continuationʢ࠶ʣ • ಉظίʔυͱඇಉظίʔυؒΛ݁ͼ͚ͭΔػߏɻ • init(_:bufferingPolicy:_:)ͰAsyncStreamʹ౉ͨ͠Ϋϩʔδϟ͸ɺ ݺͼग़͞ΕΔͱ͜ͷܕͷΠϯελϯεΛड͚औΔɻ͜ͷܧଓΛ࢖ͬͯɺyield ϝιουͷ͍ͣΕ͔ΛݺͿ͜ͱͰετϦʔϜʹཁૉΛ౉͠ɺfinish()ϝιο υΛݺͿ͜ͱͰετϦʔϜΛਖ਼ৗʹऴྃ͢Δɻ • SwiftͷଞͷܧଓͱҟͳΓɺAsyncStream.Continuation͸ΤεέʔϓΛα ϙʔτ͢Δɻ https://developer.apple.com/documentation/swift/asyncstream/continuation

Slide 51

Slide 51 text

࣮͸Ϋϩʔδϟͷ֎ʹऔΓग़ͤͪΌ͏ͷͰ͢ʂ • ݟͨ໨ʹ൓͢Δ • ͔͠΋ͳΜ͔μα͍ var continuation: AsyncStream.Continuation! AsyncStream { continuation = $0 } continuation.finish()

Slide 52

Slide 52 text

ετϦʔϜͱܧଓͷ྆ํΛฦ͢ʂ let (stream, continuation) = AsyncStream.makeStream(of: Int.self) await withTaskGroup(of: Void.self) { group in group.addTask { for i in 0...9 { continuation.yield(i) } continuation.finish() } group.addTask { for await i in stream { print(i) } } }

Slide 53

Slide 53 text

ؾʹͳΔ… let (stream, continuation) = AsyncStream.makeStream(of: Int.self) await withTaskGroup(of: Void.self) { group in group.addTask { for i in 0...9 { continuation.yield(i) } continuation.finish() } group.addTask { for await i in stream { print(i) } } } ໭Γ஋͕௝͘͠λϓϧ

Slide 54

Slide 54 text

ͳΜ͔ͷܕͰ͸ͳ͘λϓϧͰฦ͢ར఺ • ฦ٫͞ΕͨܕΛ෼ղ͢ΔΑ͏Ϣʔβʹଅ͢ɻ͜Ε͸ɺϓϩσϡʔαͱίϯ γϡʔϚ͕ͦΕͧΕܧଓͱετϦʔϜΛอ࣋͢΂͖ͳͷͰ๬·͍͜͠ͱͰ͋ Δɻ • ͜ͷϝιουΛόοΫσϓϩΠͰ͖Δɻ

Slide 55

Slide 55 text

ͦΕͧΕߦ͖ઌ͕ҧ͏ʂ let (stream, continuation) = AsyncStream.makeStream(of: Int.self) await withTaskGroup(of: Void.self) { group in group.addTask { for i in 0...9 { continuation.yield(i) } continuation.finish() } group.addTask { for await i in stream { print(i) } } } ܧଓ͸producer͕࢖͏ ετϦʔϜ͸consumer͕࢖͏

Slide 56

Slide 56 text

makeStream΋iOS 13.0+ https://developer.apple.com/documentation/swift/asyncstream/makestream(of:bu ff eringpolicy:)

Slide 57

Slide 57 text

Swift 5.5ʢ2021೥ʣͷࠒͷ৘੎ • ΄΅ಉ࣌ʹiOS 15.0͕ग़ͨ • ଟ෼ΈΜͳ3όʔδϣϯͿΜʢiOS 13.0·Ͱʣ͘Β͍Λαϙʔτͯ͠Δ • جຊతʹ͸৽API͕ग़ͯ΋աڈόʔδϣϯͷαϙʔτΛ΍ΊΔ·Ͱ࢖͑ͳ͍ Swift Concurrency͕iOS 13.0Ͱ΋࢖͑Ε͹ϋοϐʔʂʂʂʂʂ όοΫϙʔτ͞ΕΕ͹

Slide 58

Slide 58 text

όοΫϙʔτ͞Εͨྫ • Swift Concurrency • viewIsAppearing(_:) • ͱ͔ • ৄ͘͠͸ڈ೥ͷiOSDC Japanͷauramagi͞ΜͷൃදΛ͝ཡ͍ͩ͘͞ https://fortee.jp/iosdc-japan-2024/proposal/f30647c8-dd78-4853-8718-7bcb856b1239
 https://www.docswell.com/s/usami-k/5M1P4L-uiviewcontroller-viewisappearing

Slide 59

Slide 59 text

೥ද • 2021೥9݄ Swift 5.5ͰSwift ConcurrencyσϏϡʔ • 2021೥12݄ Xcode 13.2ͰSwift Concurrency͕iOS 13.0΁όοΫϙʔτ͞ΕΔ • 2023೥3݄ Swift 5.8Ͱ@backDeployed͕௥Ճ͞ΕΔ • 2023೥9݄ Swift 5.9ͰmakeStream͕௥Ճ͞ΕΔɺόοΫσϓϩΠ΋͞ΕΔ https://speakerdeck.com/satotakeshi/swift-concurrencyru-men
 https://team-blog.mitene.us/%E5%AE%B6%E6%97%8F%E3%82%A2%E3%83%AB%E3%83%90%E3%83%A0-%E3%81%BF%E3%81%A6%E3%81%AD-%E3%81%ABswift- concurrency%E3%82%92%E5%B0%8E%E5%85%A5%E3%81%97%E3%81%BE%E3%81%97%E3%81%9F-1bafc45ab3f3

Slide 60

Slide 60 text

೥ද • 2021೥9݄ Swift 5.5ͰSwift ConcurrencyσϏϡʔ • 2021೥12݄ Xcode 13.2ͰSwift Concurrency͕iOS 13.0΁όοΫϙʔτ͞ΕΔ • 2023೥3݄ Swift 5.8Ͱ@backDeployed͕௥Ճ͞ΕΔ • 2023೥9݄ Swift 5.9ͰmakeStream͕௥Ճ͞ΕΔɺόοΫσϓϩΠ΋͞ΕΔ https://speakerdeck.com/satotakeshi/swift-concurrencyru-men
 https://team-blog.mitene.us/%E5%AE%B6%E6%97%8F%E3%82%A2%E3%83%AB%E3%83%90%E3%83%A0-%E3%81%BF%E3%81%A6%E3%81%AD-%E3%81%ABswift- concurrency%E3%82%92%E5%B0%8E%E5%85%A5%E3%81%97%E3%81%BE%E3%81%97%E3%81%9F-1bafc45ab3f3 👇ʁʁʁʁʁ👆

Slide 61

Slide 61 text

όοΫϙʔτʁόοΫσϓϩΠʁ • ຊൃදͰ͸ҎԼͷΑ͏ʹఆΊ·͢ • όοΫϙʔτɿݹ͍OSͰ΋৽ػೳ͕࢖͑Δͱ͍͏͜ͱɺͦͯ͠ख๏શൠ • όοΫσϓϩΠɿ@backDeployedʹΑΔόοΫϙʔτ

Slide 62

Slide 62 text

೥ද • 2021೥9݄ Swift 5.5ͰSwift ConcurrencyσϏϡʔ • 2021೥12݄ Xcode 13.2ͰSwift Concurrency͕iOS 13.0΁όοΫϙʔτ͞ΕΔ • 2023೥3݄ Swift 5.8Ͱ@backDeployed͕௥Ճ͞ΕΔʢSE-0376ʣ • 2023೥9݄ Swift 5.9ͰmakeStream͕௥Ճ͞ΕΔɺόοΫσϓϩΠ΋͞ΕΔ https://speakerdeck.com/satotakeshi/swift-concurrencyru-men
 https://team-blog.mitene.us/%E5%AE%B6%E6%97%8F%E3%82%A2%E3%83%AB%E3%83%90%E3%83%A0-%E3%81%BF%E3%81%A6%E3%81%AD-%E3%81%ABswift- concurrency%E3%82%92%E5%B0%8E%E5%85%A5%E3%81%97%E3%81%BE%E3%81%97%E3%81%9F-1bafc45ab3f3

Slide 63

Slide 63 text

@backDeployed͕͍Δʂ https://developer.apple.com/documentation/swift/asyncstream/init(_:bu ff eringpolicy:_:)
 https://developer.apple.com/documentation/swift/asyncstream/makestream(of:bu ff eringpolicy:)

Slide 64

Slide 64 text

Ͱɺ@backDeployed͕Կͩͬͯʁ • چOSʹଘࡏ͠ͳ͍ؔ਺Λίϐʔ͖ͯͯ͠࢖͑ΔΑ͏ʹ͢Δ࢓૊Έ • makeStreamͷ໭Γ஋Λ৽نͷܕʹ͢Δͱɺ@backDeployedΛཔΕͳ͘ͳΔ struct ৽͍͠ܕ { var continuation: Continuation var stream: AsyncStream } @backDeployed(ུ) func makeStream() -> ৽͍͠ܕ // ແཧͦ͏

Slide 65

Slide 65 text

ͳΜ͔ͷܕͰ͸ͳ͘λϓϧͰฦ͢ར఺ • ฦ٫͞ΕͨܕΛ෼ղ͢ΔΑ͏Ϣʔβʹଅ͢ɻ͜Ε͸ɺϓϩσϡʔαͱίϯ γϡʔϚ͕ͦΕͧΕܧଓͱετϦʔϜΛอ࣋͢΂͖ͳͷͰ๬·͍͜͠ͱͰ͋ Δɻ • ͜ͷϝιουΛόοΫσϓϩΠͰ͖Δɻ

Slide 66

Slide 66 text

ײ૝ • ໘ന͍ͱ͸ࢥ͏ • ஌ͬͯͯ໾ʹཱ͔ͭͱ͍͏ͱɾɾ • ͜Μͳਓʹ͓͢͢Ί • Continuation͸޷͖͚ͩͲΫϩʔδϟ͸ͳ͍͍͔ͯ͘ͳͬͯਓ

Slide 67

Slide 67 text

΍͍ͬͯͥ͘ʂ • SE-0298 Async/Await: Sequences ✅ • SE-0314 AsyncStream and AsyncThrowingStream ✅ • SE-0388 Convenience Async[Throwing]Stream.makeStream methods ✅ • SE-0421 Generalize e ff ect polymorphism for AsyncSequence and AsyncIteratorProtocol • SE-0468 Hashable conformance for Async(Throwing)Stream.Continuation

Slide 68

Slide 68 text

SE-0421 Generalize effect polymorphism for AsyncSequence and AsyncIteratorProtocol

Slide 69

Slide 69 text

SE-0421 • https://github.com/swiftlang/swift-evolution/blob/main/proposals/0421- generalize-async-sequence.md • Swift 6.0ʢ2024೥ʣ • Throwsͱisolationͷ؍఺ͰAsyncSequenceΛվྑͨ͠΍ͭ • ຊ೔ͷڧఢ

Slide 70

Slide 70 text

͜Ε͕૿͑·ͨ͠ʂ protocol AsyncIteratorProtocol { associatedtype Failure: Error = any Error mutating func next( isolation actor: isolated (any Actor)? ) async throws(Failure) -> Element? }

Slide 71

Slide 71 text

SE-0421ϨϏϡʔʢʁʣ ೉қ౓ ˒˒˒ˑˑ ཁٻ͞ΕΔSwiftͷ஌͕ࣝଟ͍ ௕͞ ˒ˑˑˑˑ .md্Ͱ͸271ߦ ॻ͍ͯ͋Δ಺༰ࣗମ͸؆ܿ ॏཁ౓ ˒ˑˑˑˑ ஌Βͳͯ͘΋Αͦ͞͏

Slide 72

Slide 72 text

SE-0421ͷ͓΋͠ΖτϐοΫ • AsyncSequenceͱprimary associated type • AsyncIteratorProtocolͱ@rethrows • AsyncIteratorProtocolͱisolation

Slide 73

Slide 73 text

SE-0421ͷ͓΋͠ΖτϐοΫ • AsyncSequenceͱprimary associated type • AsyncIteratorProtocolͱ@rethrows • AsyncIteratorProtocolͱisolation

Slide 74

Slide 74 text

͜Εͷ͜ͱͰ͢ʂʢ࠶ʣ protocol AsyncIteratorProtocol { associatedtype Failure: Error = any Error mutating func next( isolation actor: isolated (any Actor)? ) async throws(Failure) -> Element? }

Slide 75

Slide 75 text

SE-0346ʢSwift 5.7ʣͰॻ͚ΔΑ͏ʹͳͬͨ protocol AsyncIteratorProtocol { associatedtype Failure: Error = any Error }

Slide 76

Slide 76 text

Primary associated typeͰͰ͖Δ͜ͱ • 👇͕࣮૷Ͱ͖Δ extension AsyncSequence { public func map( _ transform: @Sendable @escaping (Element) async throws -> Transformed ) -> some AsyncSequence { ... } } ΊͬͪΌmap΍ fi lterΛͯ͠΋ೖΕࢠʹͳΒͳ͍🎉 ※ඪ४ϥΠϒϥϦͷmap(_:)ͷ໭Γ஋ͷܕ͸૬มΘΒͣAsyncThrowingMapSequence ࣗ෼Ͱsome AsyncSequenceʹ͠Α͏ʂ

Slide 77

Slide 77 text

Primary associated typeಋೖ࡞ۀ • @rethrowsʢ👈୭͓ͩલʣͷ࢖༻Λ΍Ί·͢

Slide 78

Slide 78 text

SE-0421ͷ͓΋͠ΖτϐοΫ • AsyncSequenceͱprimary associated type ✅ • AsyncIteratorProtocolͱ@rethrows • AsyncIteratorProtocolͱisolation

Slide 79

Slide 79 text

AsyncIteratorProtocolͱthrow • next()͸ྫ֎Λ౤͛͏Δ͕ɺඞཁͳ͍΋ͷʹ·ͰtryΛॻ͘ͷ͸ͩΔ͍ • ίϯύΠϥ͕ඞཁͰͳ͍͜ͱΛݕ஌͢Ε͹ɺলུΛೝΊΒΕΔ for try await value in throwingAsyncSequence { } for await value in nonThrowingAsyncSequence { } ͍Δ ͍Βͳ͍

Slide 80

Slide 80 text

ίϯύΠϥ͕ݕ஌͢Δํ๏ • AsyncSequence΍AsyncSequenceIteratorࣗମʹ@rethrows͕͍ͭͯͨ • աڈܗ @rethrows public protocol AsyncSequence { @rethrows public protocol AsyncIteratorProtocol { https://github.com/swiftlang/swift/blob/9067148bc9c9a72730dbeebef32965b3aaeb34fb/stdlib/public/Concurrency/AsyncSequence.swift#L75-L76
 https://github.com/swiftlang/swift/blob/9067148bc9c9a72730dbeebef32965b3aaeb34fb/stdlib/public/Concurrency/AsyncIteratorProtocol.swift#L90-L91

Slide 81

Slide 81 text

@rethrows protocol • Experimental featureʢͩͬͨΒ͍͠ʣ • some AsyncSequenceͱซ༻͍͕ͨͦ͠͏͢Δͱ@rethrows͕ػೳ͠ͳ͍ • ͳͷͰSwift 6.0͔Β@rethrowsΛ࢖͏ͷΛ΍ΊͨͬΆ͍ • ৄ͘͠͸Point-Freeͷهࣄɺ΋͘͠͸ڈ೥ͷtreastrain͞Μͷൃද https://github.com/swiftlang/swift/commit/bb7a563e6c7756dc6c3c910db7ecacab2e1698b7
 https://fortee.jp/iosdc-japan-2024/proposal/c0c62dc1-992c-4d9f-8812-02994593d96c
 https://www.pointfree.co/blog/posts/73-parser-errors

Slide 82

Slide 82 text

SE-0421ͷ͓΋͠ΖτϐοΫ • AsyncSequenceͱprimary associated type ✅ • AsyncIteratorProtocolͱ@rethrows ✅ • AsyncIteratorProtocolͱisolation

Slide 83

Slide 83 text

AsyncIteratorProtocolͱisolation ʢ5.9ҎԼͷ࣌ʣ • next()͸nonisolatedͳͷͰִ཭͞Εͨॴ͔Β࢖͏ͱ͍Ζ͍ΖڥքΛӽ͑Δ • ໭Γ஋Ͱ͋ΔElement͕ڥքΛӽ͑Δ • Element͕ඇSendableͳ࣌ʹcheckʹҾ͔͔ͬΔ • AsyncIteratorProtocolࣗ਎΋ڥքΛӽ͑Δ • ΠςϨʔλ͕ඇSendableͳ࣌ʹcheckʹҾ͔͔ͬΔ

Slide 84

Slide 84 text

ӽ͑Δͱ͖ͬͯͲΜͳͱ͖ @MainActor func iterate(over stream: AsyncStream) async { var iterator = stream.makeAsyncIterator() while let element = await iterator.next() { // do something with 'element' } } https://github.com/swiftlang/swift-evolution/blob/main/proposals/0420-inheritance-of-actor-isolation.md

Slide 85

Slide 85 text

ӽ͑Δͱ͖ͬͯͲΜͳͱ͖ @MainActor func iterate(over stream: AsyncStream) async { var iterator = stream.makeAsyncIterator() while let element = await iterator.next() { // do something with 'element' } } warning:
 passing argument of non-sendable type 'inout AsyncStream.Iterator'
 outside of main actor-isolated context may introduce data races https://github.com/swiftlang/swift-evolution/blob/main/proposals/0420-inheritance-of-actor-isolation.md

Slide 86

Slide 86 text

ӽ͑Δͱ͖ͬͯͲΜͳͱ͖ @MainActor func iterate(over stream: AsyncStream) async { var iterator = stream.makeAsyncIterator() while let element = await iterator.next() { // do something with 'element' } } ؔ਺ࣗମ͸MainActorʹִ཭͞ΕͯΔ ͍ͭ͜͸nonisolated https://github.com/swiftlang/swift-evolution/blob/main/proposals/0420-inheritance-of-actor-isolation.md

Slide 87

Slide 87 text

ӽ͑Δͱ͖ͬͯͲΜͳͱ͖ @MainActor func iterate(over stream: AsyncStream) async { var iterator = stream.makeAsyncIterator() while let element = await iterator.next() { // do something with 'element' } } next()ͷҾ਺ͱ໭Γ஋Ͱ͋Δ͜ͷ2ͭ͸ڥքΛӽ͑Δ͜ͱʹͳΔ https://github.com/swiftlang/swift-evolution/blob/main/proposals/0420-inheritance-of-actor-isolation.md

Slide 88

Slide 88 text

AsyncIteratorProtocolͱisolation ʢ5.10ҎԼͷ࣌ʣ • next()͸nonisolatedͳͷͰִ཭͞Εͨॴ͔Β࢖͏ͱ͍Ζ͍ΖڥքΛӽ͑Δ • ໭Γ஋Ͱ͋ΔElement͕ڥքΛӽ͑Δ • Element͕ඇSendableͳ࣌ʹcheckʹҾ͔͔ͬΔ • AsyncIteratorProtocolࣗ਎΋ڥքΛӽ͑Δ • ΠςϨʔλ͕ඇSendableͳ࣌ʹcheckʹҾ͔͔ͬΔ ݩڟ

Slide 89

Slide 89 text

AsyncIteratorProtocolͱisolation ʢ6.0Ҏ্ͷ࣌ʣ • #isolationΛड͚औΕΔΑ͏ͳnextϝιου͕͋Δ • func next(isolation actor: isolated (any Actor)?) • SE-0414 Region based isolationͷ໊લ͕ग़͍ͯΔ͕ɺ
 SE-0414͕͜ͷ໰୊Λղܾ͍ͯ͠ΔΘ͚Ͱ͸ͳ͍ɾɾͱࢥ͏ next(isolation: #isolation)Λۦ࢖͢Δ͜ͱͰɺRegion based isolationΛՃຯͨ͠ݱࡏͷconcurrency checkΛύε͠Α͏ͶɺͱಡΊͳ͍͜ͱ΋ͳ͍

Slide 90

Slide 90 text

AsyncIteratorProtocolͱisolation ʢ6.0Ҏ্ͷ࣌ʣ • #isolationΛड͚औΕΔΑ͏ͳnextϝιου͕͋Δ • func next(isolation actor: isolated (any Actor)?) • SE-0414 Region based isolationͷ໊લ͕ग़͍ͯΔ͕ɺ
 SE-0414͕͜ͷ໰୊Λղܾ͍ͯ͠ΔΘ͚Ͱ͸ͳ͍ɾɾͱࢥ͏ next(isolation: #isolation)Λۦ࢖͢Δ͜ͱͰɺRegion based isolationΛՃຯͨ͠ݱࡏͷconcurrency checkΛύε͠Α͏ͶɺͱಡΊͳ͍͜ͱ΋ͳ͍ SE-0313ʢSwift 5.5ʣ͔Β͋Δ

Slide 91

Slide 91 text

AsyncIteratorProtocolͱisolation ʢ6.0Ҏ্ͷ࣌ʣ • #isolationΛड͚औΕΔΑ͏ͳnextϝιου͕͋Δ • func next(isolation actor: isolated (any Actor)?) • SE-0414 Region based isolationͷ໊લ͕ग़͍ͯΔ͕ɺ
 SE-0414͕͜ͷ໰୊Λղܾ͍ͯ͠ΔΘ͚Ͱ͸ͳ͍ɾɾͱࢥ͏ next(isolation: #isolation)Λۦ࢖͢Δ͜ͱͰɺRegion based isolationΛՃຯͨ͠ݱࡏͷconcurrency checkΛύε͠Α͏ͶɺͱಡΊͳ͍͜ͱ΋ͳ͍ non-isolatedΛදݱ͢ΔͨΊʹඞཁ ݺͼग़͠ଆͷִ཭

Slide 92

Slide 92 text

SE-0421ͷ͓΋͠ΖτϐοΫ • AsyncSequenceͱprimary associated type ✅ • AsyncIteratorProtocolͱ@rethrows ✅ • AsyncIteratorProtocolͱisolation ✅

Slide 93

Slide 93 text

Ͱɺpolymorphism͕ͳΜͩͬͯʁ • Polymorphismͷجຊతͳҙຯ͸ɺʮ1 ͭͷؔ਺ (͋Δ͍͸ϝιουɺࣜͳͲ) ͕ɺ༷ʑͳܕΛ΋ͭҾ਺ʹద༻Ͱ͖Δʯͱ͍͏ҙຯ by ஜ೾େֶतۀ https://www.cs.tsukuba.ac.jp/~kam/lecture/plm2010/12.pdf protocol AsyncIteratorProtocol { associatedtype Failure: Error = any Error mutating func next( isolation actor: isolated (any Actor)? ) async throws(Failure) -> Element? }

Slide 94

Slide 94 text

ײ૝ • Swift 6.0ɺΠϚυΩ͔ͬͯΜ͡ʙ • Swift 6Λཧղ͢Δඞཁ͸ʢଟ෼ʣ͋Δ͕͜Ε͡Όͳͯ͘SE-0420ΛಡΉ΂͖ • ͜Μͳਓʹ͓͢͢Ί • ࣗ෼ͷSwift 6΁ͷཧղྗΛࢼ͍ͨ͠ਓ

Slide 95

Slide 95 text

΍͍ͬͯͥ͘ʂ • SE-0298 Async/Await: Sequences ✅ • SE-0314 AsyncStream and AsyncThrowingStream ✅ • SE-0388 Convenience Async[Throwing]Stream.makeStream methods ✅ • SE-0421 Generalize e ff ect polymorphism for AsyncSequence and AsyncIteratorProtocol ✅ • SE-0468 Hashable conformance for Async(Throwing)Stream.Continuation

Slide 96

Slide 96 text

SE-0468 Hashable conformance for Async(Throwing)Stream.Continuation

Slide 97

Slide 97 text

ContinuationʹHashableΛ͚ͭͨΑɻ @available(SwiftStdlib 6.2, *) extension AsyncStream.Continuation: Hashable { https://github.com/swiftlang/swift/blob/b916be3b6270cf844075ca9ac4ed1a015334b6b5/stdlib/public/Concurrency/AsyncStream.swift#L478-L479 EquatableͰ΋͋Δ

Slide 98

Slide 98 text

SE-0468ϨϏϡʔʢʁʣ ೉қ౓ ˒ˑˑˑˑ લఏ஌͕ࣝͱͯ΋͍Βͳ͍ ௕͞ ˒ˑˑˑˑ .md্Ͱ͸130ߦ
 ͱʙʙʙͬͯ΋୹͍ʂ ॏཁ౓ ˒ˑˑˑˑ ಛචࣄ߲ͳ͠

Slide 99

Slide 99 text

SE-0468 Motivationͷ༁ʢൈਮʣ • ෳ਺ͷAsyncStreamΛૢ࡞͢ΔϢʔεέʔεͰ͸ɺෳ਺ͷܧଓΛอ࣋͢Δඞ ཁ͕͋Δ͔΋͠Εͳ͍ɻ • ؔ࿈͢ΔܧଓΛಛఆ͢ΔͨΊɺΫϥΠΞϯτίʔυ͸ܧଓಉ࢜ΛൺֱͰ͖Δ ඞཁ͕͋Δɻ

Slide 100

Slide 100 text

αϯϓϧίʔυ var value: Int = 0 { didSet { for c in continuations { c.yield(value) } } } var values: some AsyncSequence { AsyncStream(bufferingPolicy: .bufferingNewest(1)) { continuation in continuation.yield(value) self.continuations.insert(continuation) continuation.onTermination = { _ in DispatchQueue.main.async { self.continuations.remove(continuation) } } } } private var continuations: Set.Continuation> = []

Slide 101

Slide 101 text

αϯϓϧίʔυ var value: Int = 0 { didSet { for c in continuations { c.yield(value) } } } var values: some AsyncSequence { AsyncStream(bufferingPolicy: .bufferingNewest(1)) { continuation in continuation.yield(value) self.continuations.insert(continuation) continuation.onTermination = { _ in DispatchQueue.main.async { self.continuations.remove(continuation) } } } } private var continuations: Set.Continuation> = [] where Element: Hashable

Slide 102

Slide 102 text

ContinuationΛͲ͏΍ͬͯHashableʹ͢Δͷ • Continuationͷத਎͸class _StorageͳͷͰ͍ͦͭΛ࢖͏ • static func == (Self, Self) -> Bool • _StorageͷಉҰੑΛݟΕ͹OK • func hash(into: inout Hasher) • ObjectIdentifier(storage)ΛࠞͥΕ͹OK https://github.com/swiftlang/swift/blob/8c1cc1b78a7bd4b46d53706e92ab864c25f09f04/stdlib/public/Concurrency/AsyncStream.swift#L478-L492

Slide 103

Slide 103 text

ײ૝ • ͦ͏Ͱ͢Ͷ

Slide 104

Slide 104 text

΍͍ͬͯͥ͘ʂ • SE-0298 Async/Await: Sequences ✅ • SE-0314 AsyncStream and AsyncThrowingStream ✅ • SE-0388 Convenience Async[Throwing]Stream.makeStream methods ✅ • SE-0421 Generalize e ff ect polymorphism for AsyncSequence and AsyncIteratorProtocol ✅ • SE-0468 Hashable conformance for Async(Throwing)Stream.Continuation ✅

Slide 105

Slide 105 text

·ͱΊ

Slide 106

Slide 106 text

ࠓճొ৔ͨ͠օ͞Μ • A

Slide 107

Slide 107 text

ײ૝ • ͜ΕΒͷϓϩϙʔβϧΛಡΉඞཁ͸ͳ͍Ͱ͢ • جຊతʹ͸௥Ճ͞ΕΔϝιουͷҰཡ͕ࡌͬͯΔ͚ͩͳͷͰ… • AsyncSequence΍AsyncStreamͷڍಈʹ͍ͭͯ͸Կ΋৮ΕΒΕͯͳ͍ • ֤छݴޠػೳͷཱ೿ͳ࢖༻ྫͰ͸͋Δ