-
Notifications
You must be signed in to change notification settings - Fork 4
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
Tests or examples exercising Farolero with Clojure async and js/Promise #20
Comments
Hey, thanks for opening the issue. I can definitely work to do that, but I also just need to caution you: farolero and the mechanisms of conditions and restarts in general rely heavily on the stack (although this could probably be at least partially avoided in a language with reified continuations, but that would cause its own issues). The entire purpose of core.async and promises is that they remove the stack context from execution. This leads to a couple rules you can follow depending on if you're using a promise-like API, and a second set of rules you can follow with an async/await-like API (like core.async). For Promises: do not invoke restarts that were bound outside of the lambda passed to the Promise level that the signal came from, and if you want to use bound handlers then construct promises using For async/await: treat puts and takes as if they split the code in two, the code that was evaluated before, and the code that's evaluated after. Never bind a restart around a split, only bind restarts fully within one section of the code. Then treat these sections the same way as you treat a promise lambda, and be aware it automatically acts like For both: handlers bound with An additional note here is that in ClojureScript invoking a bad restart or signaling something under a |
Thanks @IGJoshua . The information you shared might serve as enough documentation for me to go with for now. I spent a few hours considering ClojureScript support for the base One focus that arose is automated testing those parts of ART that uses Farolero to signal conditions. And given that this is JavaScript, the land of asynchronous calls, I seek to thoroughly exercise and prove correctness of ART when used in CSP-style scenarios. Covering js/Promise, core.async, and even (overkill?) promesa and manifold would drive the point that both Farolero and ART are reliable in such scenarios + serve as examples on how to interface with them in each programming style. Thanks for Farolero BTW, I'm really enjoying it! |
Hi!
It would be highly instructive to me if the project supplied some tests or documentation that exercises Farolero with Clojure(Script) async as well as ClojureScript code that interops with
js/Promise
.Are there any established patterns that can be relied upon as a kind of known-good practice?
The text was updated successfully, but these errors were encountered: