Skip to content

Nesting custom operations within bind closures for computation expressions #5962

@gerardtoconnor

Description

@gerardtoconnor

I have a CE that uses customOperations and uses bind for binding async tasks, if a place binds (let!) after binds, they are nested continuations, but using any customOperations after any binds means they run instantly after the async starts (task returned), and not being wrapped up into the let! continuations like is the case with subsequent binds. I have been using the MaintainsVariableSpaceUsingBind=true given it's a binding CE, but no matter what permutations of attributes I use, I cannot get customOperations to wrapped up into the bind continuations, they run immediately after the async work starts, completing before the bind continuation subsequently starts.

At the end of my use of customOperations before bind, I can Bind the INode<'T> state into ctx before the bind continuations start, its just the post customOperations that I want to get wrapped into the bind continuations that are the problem. @dsyme may be one of the few people able to assist as I know CE & CustomOperations are a but niche

    [<CustomOperation("text",MaintainsVariableSpaceUsingBind=true)>] 
    member inline x.Text<'a>(n:INode<'T>, text: string ) =  x.Text(text); n
…
    ce {
        let! work = SomeAsyncTask()
        text "work is done … oh wait, what!? no it's not!?" // runs before task finished but want wrapped in continuation
    }

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions