GithubHelp home page GithubHelp logo

Idea: skip process handling about alpaca HOT 1 OPEN

etnt avatar etnt commented on July 26, 2024
Idea: skip process handling

from alpaca.

Comments (1)

j14159 avatar j14159 commented on July 26, 2024

Thanks!

Send/receive strikes me as a central feature for Erlang ("receive" is actually a part of the Core Erlang AST) and I wanted to work towards supporting all of those so that people would be able to use MLFE itself for as many things as possible. Missing items like try, catch, and error are all on my short-term TODO list with things like links in the medium term.

When it comes to OTP functionality like gen_server we actually need parameterized modules and an improved FFI to type properly. At a bare minimum we'd need things like parametric interfaces (like a very restrictive ML signature) that modules can implement and FFI extensions to type the server returned. I think this will unfortunately require a handful of explicit type annotations (at least for the interface) but it seems a small price to pay for an even more lightweight FFI with no Erlang code necessary to bridge it. A half-baked and potentially problem-laden interface might look like the following:

interface minimal_gen_server 'state 'messages 'replies

type call_result = (reply, 'replies, 'state) | (noreply, 'state)

init 'b:  'b -> (ok, 'state)

handle_call:  'messages -> pid _ -> 'state -> call_result

Where something like the FFI bridge for gen_server:start might look like:

type gen_server 'messages 'replies = GenServer pid 'messages

start 'a 'b 'c: minimal_gen_server 'a 'b 'c -> 'a -> gen_server 'b 'c
bridge start mod init = match gen_server.start(mod, init, []) with
  (ok, pid) -> GenServer pid

Here bridge would entail a fair bit of unification and I'm sure there are buckets of problems, not least of which is we're not actually capturing the 'replies type in that gen_server ADT properly but this is all off the cuff :)

from alpaca.

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.