Replies: 4 comments
-
Anyway, I just want to point out that the TaskSeq naming isn't perfect Putting aside legacy, the ideal for naming and simplicity purposes would be
Then we'd be back to the nicest position that there is just That makes me wonder if we should already be deprecating/renaming FSharp.Control.AsyncSeq to make room for this. Maybe renaming to |
Beta Was this translation helpful? Give feedback.
-
I see your point, but I'm not sold on this. F# Core has two distinct builders, one for People have come to associate If we want to move forward to a single library approach for asynchronous sequences, it's likely that some of the current library functions of Also, since most F# programmers that I know have typically moved from I realize there's no perfect solution here. I can certainly see a use-case, and definitely until Also, with 250k downloads of the latest version alone, and 1.4M in total, deprecating |
Beta Was this translation helpful? Give feedback.
-
PS: yes, I can see this confusion. The reason I started all of this was that in my team people were literally writing code that had This prompted me, among giving some education on Which reminds me, I should probably remove functions like |
Beta Was this translation helpful? Give feedback.
-
Noticed something else: let x = asyncSeq {
yield 1
}
x :> IAsyncEnumerable<_> // not possible We could also implement that interface, though it'll be confusing, as the internally used interface is same-named, they only differ in the naming of getting the enumerator: I know there's Not saying there isn't any confusion now. But I just think that having the two disparate yet seemingly equal worlds: tasks and asyncs in the F# ecosystem maybe the best of all the bad choices we have ;). |
Beta Was this translation helpful? Give feedback.
-
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
HotSynchronousFastEnumerator
IEnumerable<T>
F# IEnumerable = Seq
ColdSynchronousFastEnumerable
unit -> IEnumerable<T>
.NET/F#/C# Task = C# async/await
HotAsynchronousFastValue
Task<T>
IcedTask ColdTask
ColdAsynchronousFastValueFactory
unit -> Task<T>
IcedTask CancellableTask
ColdAsynchronousFastCancellableValueFactory
CancellationToken -> Task<T>
Async = F# async
ColdAsynchronousCancellableValueFactory
CancellationToken -> Task<T>
Current F# AsyncSeq
ColdAsynchronousCancellableEnumerable
CancellationToken -> IAsyncEnumerator<T>
Current F# TaskSeq
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).
Beta Was this translation helpful? Give feedback.
All reactions