Description
I do notice the name "TaskSeq" is confusing some people - people thinking this is about "sequences of tasks". I'm not sure what to do about this.
While thinking about this I included some general notes on naming in this space, see below
-
F# IEnumerator
- cold start
- run once
- no implicit cancellation token
- no asynchronous waits
- many results
- state machines
- =
HotSynchronousFastEnumerator
- =
IEnumerable<T>
-
F# IEnumerable = Seq
- cold start
- run multiple
- no implicit cancellation token
- no asynchronous waits
- many results
- state machines
- =
ColdSynchronousFastEnumerable
- ~=
unit -> IEnumerable<T>
-
.NET/F#/C# Task = C# async/await
- hot start
- run once
- no implicit cancellation token
- asynchronous waits
- one result
- state machines
- =
HotAsynchronousFastValue
- =
Task<T>
-
- cold start
- run many times
- no implicit cancellation token
- asynchronous waits
- one result
- state machines
- =
ColdAsynchronousFastValueFactory
- ~=
unit -> Task<T>
-
- cold start
- run many
- implicit cancellation token
- asynchronous waits
- one result
- state machines
- =
ColdAsynchronousFastCancellableValueFactory
- ~=
CancellationToken -> Task<T>
-
Async = F# async
- cold start
- run multiple
- implicit cancellation token
- asynchronous waits, one result
- no state machines
- =
ColdAsynchronousCancellableValueFactory
- ~=
CancellationToken -> Task<T>
-
Current F# AsyncSeq
- cold start
- run multiple
- implicit cancellation token
- asynchronous waits
- many results
- no state machines
- =
ColdAsynchronousCancellableEnumerable
- ~=
CancellationToken -> IAsyncEnumerator<T>
-
Current F# TaskSeq
- cold start
- run multiple
- implicit cancellation token governing iteration but not passed to each task along the way
- asynchronous waits
- many results
- state machines
- =
ColdAsynchronousHalfCancellableEnumerable
- ~=
CancellationToken -> IAsyncEnumerator<T>
I'm leaving the question of tailcalls off the list, as much as I'd like to address that.
It's worth noting that at a high level there's no real logical difference between CancellableTask
and F# Async<_>
. Nor between F# TaskSeq
and F# AsyncSeq
.
The sweet spot for F# is really Cold+RunMany+Asynchronous+Fast+Cancellable+Tailcalls, which is what TaskSeq is close to being technically (except tailcalls, sadly).