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

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

Open
aneilbaboo opened this issue Jan 19, 2022 · 0 comments
Open

Comments

@aneilbaboo
Copy link
Contributor

aneilbaboo commented Jan 19, 2022

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
   ...)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant