Skip to content

Suspending functions should throw an error when used outside of deflow #47

@aneilbaboo

Description

@aneilbaboo

It's very easy in the course of coding to use a suspending function inside a defn. This can lead to Suspend signals being returned as values, which is undefined and ends up being a tricky bug to track down.

Proposal is to deprecate use of ^:suspending metadata and instead implement a macro which registers suspending functions in a dynamic variable accessible to the partitioner.

(def-suspending-fn foo [bar]
   (if bar (listen! ...)))

(foo true) => Exception!!!

(deflow baz [] 
   (foo true) ; suspends
   ...)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions