Skip to content
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

interpret do! action as let! () = action in zero when the Builder has no Return defined #17

Open
baronfel opened this issue Oct 12, 2016 · 0 comments

Comments

@baronfel
Copy link
Owner

Idea 10999326: interpret do! action as let! () = action in zero when the Builder has no Return defined

Status : completed
Submitted by Max Malook on 12/7/2015 12:00:00 AM
3 votes

In general there are two types of workflows represented by computation expressions:

  1. process (async)
  2. sequential (seq)
    The former usually uses return or return!, the later yield and yield!.
    With asyncSeq it's actually a combination of both worlds, but the main purpose is to be sequential, and also allow side effects to happen (do! Async.Sleep 200).
    Currently do! action is interpreted as let! () = action in return (), with this the Builder has to provide the Return method. With it in place also return keyword becomes available.
    In case of asyncSeq the result of return expr is completely ignored, what can lead to inconvenience for the users of asyncSeq.
    The proposal is to interpret do! action as let! () = action in zero when the Builder do not provide a Return method.
    With it return keyword would be unavailable to the users of the Builder.
    Original discussion: Presence of return is misleading fsprojects/FSharp.Control.AsyncSeq#38

Response

** by fslang-admin on 1/23/2016 12:00:00 AM **

This PR has been merged, so this design item is completed, though not yet released in a specific version of F#
This is approved for F# 4.1+. It’s the right adjustment to the language given the problem discussed in the linked gituhb thread
See also the proposed implementation here: dotnet/fsharp#773
Don Syme
F# Language and Core Library Evolution
Archived Uservoice Comments

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant