Giter Club home page Giter Club logo

factor's Introduction

factor

"function".head + "actor"

A simple experiment using only Scala functions as actors, no enclosing class/trait/etc necessary.

#What?

A simple exploration of a few things that have come up while digging deeper into both Akka and Erlang.

Example:

def myActorFunc: Factor[String] = { case (s: String, _, state) => Ok(state + s) }
new FactorSystem.spawn(myActorFunc, "")

It's still very basic, no thread pool/FJP stuff yet, no supervision, etc. I'll update this page as that changes and expect a blog post or two about it.

The short list of things I want to do at present:

  • supervision, links
  • use Doug Lea's FJ stuff for parallelism (should be pretty easy)
  • experiment with some simple scheduler design
  • OIO wrapper func that will spin a new thread allowed to block, will expand on this later.

#Why?

Erlang's approach to actors using recursive functions is awfully nice, gen_server even more so. It conveniently elminates any sort of mutable state. Obviously you could close over some external state with your actor functions but you and I both know that clearly would be stupid (so please don't do that). This code is roughly based on some ideas from gen_server. Roughly.

The idea here is to build actors from absolutely nothing but functions. You might define those functions in classes, objects, traits, whatever - the key being that you use nothing but the function parameters for state tracking. I've modelled this currently as partial functions, might change that to normal functions later.

#Is This Supposed To Replace Something?

No. Don't use it for anything serious, it's just a little experiment.

#What About Akka?

You should use Akka. It's good. A few directions I'm planning to explore with this are based on some assumptions and knowledge I have about how Akka does actors.

factor's People

Contributors

j14159 avatar

Stargazers

Outsider avatar Tyler Weir avatar

Watchers

 avatar James Cloos avatar  avatar

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.