FSharp.Control.AsyncSeq icon indicating copy to clipboard operation
FSharp.Control.AsyncSeq copied to clipboard

Rename toList/toArray to toListSynchronously/toArraySynchronously

Open blumu opened this issue 7 years ago • 2 comments

Calling Async.RunSynchronously in libraries is error-prone and can cause dead-locks. (e.g. when running on the main interactive thread.) I would just remove the two functions toList and toArray altogether to prevent library users from hitting hard-to-debug issues.

https://github.com/fsprojects/FSharp.Control.AsyncSeq/blob/9b608ff44e1d0c63c83a7de20e5e73a2f08660c2/src/FSharp.Control.AsyncSeq/AsyncSeq.fs#L1317

https://github.com/fsprojects/FSharp.Control.AsyncSeq/blob/9b608ff44e1d0c63c83a7de20e5e73a2f08660c2/src/FSharp.Control.AsyncSeq/AsyncSeq.fs#L1318

blumu avatar Dec 29 '18 02:12 blumu

It's true, though I certainly remember using these when playing around with AsyncSeq, testing and so on. Perhaps renaming to toListSynchronously and and toArraySynchronously may be right for now?

dsyme avatar Jan 08 '19 19:01 dsyme

I'd second the rename. I agree that use of Async.RunSynchronously is troublesome and that these operations conceal it (particularly from a code quality scanner).

eulerfx avatar Jan 09 '19 13:01 eulerfx