Comments (12)
How would query
work in this revised model?
Edit: Oh. I believe I understand. .next()
returns the yielded value and the call to the next next(value)
provides the return value of the yield inside the generator.
from nact.
I don't know the nact
codebase well enough yet to give well informed comments on the whole branch. However, from the examples, the API looks a lot like what I had in mind. I like how you have incorporated general IO as well as actor-specific actions.
from nact.
@biancode It's not an officially supported yet (there is no documentation for this feature, less extensive tests), but the master branch of https://github.com/ncthbrt/nact has the monad variant of the library in it. You can install it by calling I believe npm install https://github.com/ncthbrt/nact.git
from nact.
I've released the monadic implementation of nact in v7.2.2-beta0
of nact on npm, would love to get some feedback on it. (Note that I have not yet added typescript bindings for the monadic wrapper around nact)
from nact.
from nact.
Redux Saga is probably a good place to look if you're looking for a model of how this sort of thing can work. Although, I wasn't necessarily suggesting a whole suite of declarative effects, just using this model for things like message dispatch.
Is it possible that generator-based actor behaviors could be provided as an option, rather than a breaking change, using a different sort of spawn function?
Happy to help in any way I can.
from nact.
It definitely could be possible to perhaps have a parallel API for this purpose.
require('nact/monad')
which exposes identical calls to the main API, just in a side effect free manner. I'd imagine implementation wise you'd probably want to make this a wrapper around the existing implementation to reduce the maintenance and testing burden.
It's a bit unfortunate that the reason version wouldn't be able to provide a similar API. Perhaps that could be solved by using a ppx.
from nact.
@samfrances I'm quickly throwing together a prototype. Would appreciate a review when of that before proceeding to do the hard work of getting full coverage.
from nact.
@samfrances I've created a working prototype here: https://github.com/ncthbrt/nact/tree/generators
I've put an example in the examples folder. Would appreciate feedback. Note this is very far from robust, but a quick stab at an API. Note that it also includes support for const result = yield query()
as well.
from nact.
@ncthbrt Sure thing, I'll take a look tonight. Apologies, I didn't see your message until now.
from nact.
Think for this change to be worthwhile, should probably think about adding a testkit to probe actors and make assertions about their expected behaviour.
from nact.
It is to find in master branch version 7.2.1, but I got
Cannot find module 'nact/monad'
on require('nact/monad')
The monad folder is not installed if I use nact as a dependency in a project.
from nact.
Related Issues (20)
- [7.6.0] configureLogging is not accessible HOT 1
- Notify an actor created by query() when work needs to be cancelled HOT 1
- the website is dead HOT 2
- New .xyz documentation site search points to nact.io HOT 1
- Page on npmjs.com still points to old domain HOT 1
- Build Error on Typescript 4.6.2 HOT 2
- Versions out of Sync HOT 1
- onCrash not called for stateless actors
- Enable Github Discussions HOT 1
- Can't join Discord from nact.xyz/en_uk/community HOT 2
- Stateless Actors won't handle errors HOT 1
- Stateless actors are not concurrent. HOT 3
- I can't find a way to get to properties set during initialization of spawnStateless HOT 1
- onCrash does not provide access to internal message queue
- dispatch has wrong type signature HOT 2
- ActorContext type doesn't have ctx.sender property HOT 2
- when trying to compile typescript file with nact, I receive error saying dispatch accepts only 2 arguments HOT 1
- multiple instances support HOT 1
- Deno Support HOT 1
- Scaling? HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from nact.