GithubHelp home page GithubHelp logo

[Dev]: Actor Generalization about squirecore HOT 2 OPEN

TylerBloom avatar TylerBloom commented on September 27, 2024
[Dev]: Actor Generalization

from squirecore.

Comments (2)

TylerBloom avatar TylerBloom commented on September 27, 2024 1

I like the phrasing of "transient" and "permanent" actors a lot. That's a great idea.

As for API, the actor state is the part that "knows" if the state will ever terminate or not. This will allow us to restrict the scheduler accordingly. But more importantly, you should not be able to create a client that thinks it's talking to a permanent actor when it's talking to a transient actor (or, somewhat less importantly, visa versa). This is certainly possible. My larger concern is code duplication between different client types.

As for extension traits, see the Itertools trait in the itertools crate or the FutureEtx, StreamEtx, and SinkExt traits in the futures crate.

from squirecore.

akbulutdora avatar akbulutdora commented on September 27, 2024

Thanks for the detailed description of the problems. Here are my initial thoughts and questions

  • Calling the persistence of the actors lifetime might get confusing in the long run. Should we consider an alternative? I propose transient and permanent actors and permanence of actors.

  • For the API, could we allow the users to define what kind of an actor they want while building the actor (as a method on ActorBuilder)? The following seems like a good, intuitive syntax that might reduce cognitive load.

ActorBuilder::new().transient().launch();
ActorBuilder::new().persistent().launch();

// or we could get rid of `new` constructor in these cases
ActorBuilder::persistent().launch();
ActorBuilder::transient().launch();

ActorBuilder::new().launch(); // defaults to `persistent`

ActorBuilder::new().sink().launch();
ActorBuilder::new().stream().launch();

// as before, briefer constructors
ActorBuilder::stream().launch();
ActorBuilder::sink().launch();

// we could combine:
ActorBuilder::transient().sink().launch();

I haven't heard of extension traits before. I will check into them.

from squirecore.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.