-
Notifications
You must be signed in to change notification settings - Fork 832
Description
When using task computation expressions it's possible to have two return or return! statements in a row. In this case both the functions called by return/return! are executed, which wouldn't be the expected behavior according to the usually assumed meaning of return.
This can be replicated with the following code, in this case you'll see both "functionA executed" and "functionB executed" printed to the console.
`open FSharp.Core
open FSharp.Control.TaskBuilder
let functionA() =
task {
printfn "functionA executed"
}
let functionB() =
task {
printfn "functionB executed"
}
let main() =
task {
return! functionB()
return! functionA()
}
main() |> Async.AwaitTask |> Async.RunSynchronously`
Whilst computation expressions in general could allow this depending on the definition of the builder, I would argue that the standard TaskBuilder should define return in the canonical sense.
Metadata
Metadata
Assignees
Labels
Type
Projects
Status