interpret do! action
as let! () = action in zero
when the Builder has no Return defined
#19
Labels
do! action
as let! () = action in zero
when the Builder has no Return defined
#19
Idea 10999326: interpret
do! action
aslet! () = action in zero
when the Builder has no Return definedStatus : 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:
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 aslet! () = 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
aslet! () = 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
The text was updated successfully, but these errors were encountered: