-
Notifications
You must be signed in to change notification settings - Fork 21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add while! (while-bang) keyword to computation expressions #1038
Comments
I agree with this, I'll mark it approved-in-princple |
5 tasks
3 tasks
3 tasks
3 tasks
3 tasks
This was referenced Jan 11, 2024
3 tasks
This was referenced Jan 17, 2024
3 tasks
3 tasks
This was referenced Jan 19, 2024
3 tasks
3 tasks
3 tasks
3 tasks
3 tasks
3 tasks
3 tasks
3 tasks
2 tasks
This was referenced Jun 29, 2024
Closed
3 tasks
3 tasks
3 tasks
3 tasks
3 tasks
3 tasks
3 tasks
3 tasks
3 tasks
3 tasks
2 tasks
3 tasks
3 tasks
This was referenced Sep 16, 2024
3 tasks
2 tasks
3 tasks
3 tasks
3 tasks
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add while! (while-bang) keyword to computation expressions
I propose we extend the computation expression syntax with a new keyword,
while!
, that combines a let! and a typical while loop.Using the current GRPC client as an example instead of writing something like...
We should be able to do
NOTE: That the typical approach for using recursion doesn't work for TaskBuilder's from my understanding since they aren't tail recursive in many libraries that provide them.
A similar problem exists when reading rows of an ADO.NET reader. If the
while!
syntax was allowed we would be able to do something like:Instead of:
Pros and Cons
Pros: More concise code aiding readability, allows a more intuitive use of libraries exposing this pattern especially when given a Task API where using the recursive approach may not be supported, may offer a performance improvement for certain cases.
Cons: More work required to support this in the language and associated computational expressions (e.g. Task builders such as Ply).
Extra information
Estimated cost (XS, S, M, L, XL, XXL): S
Related suggestions:
#863
Affidavit (please submit!)
Please tick this by placing a cross in the box:
Please tick all that apply:
For Readers
If you would like to see this issue implemented, please click the 👍 emoji on this issue. These counts are used to generally order the suggestions by engagement.
The text was updated successfully, but these errors were encountered: