[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[ELPA] New package: derl

From: Axel Forsman
Subject: [ELPA] New package: derl
Date: Thu, 21 Sep 2023 10:19:26 +0000 (UTC)

Hello everyone:

I have written a new package called derl,
available at 
that I believe would make good addition to GNU ELPA.

It provides two main features:

* A concurrency abstraction based on Erlang-like processes.

  Similarly to promises, processes allow writing asynchronous code
  in a natural way without nested callbacks, e.g.

        (! `(rex . ,node) `[,(derl-self) [call io format ("Hi!~n") user]])
        (message "Got back result: %S" (derl-receive (`[rex ,x] x)))))

  prints the string "Hi!" in the console of the node `node',
  and logs the result when it arrives, without blocking in the interim.

  The embedding of processes is mostly faithful,
  but scheduling is not preemptive or in parallel
  due to being implemented in Emacs Lisp.
* Secondly, a means of communicating with running Erlang VMs from Emacs.

  The motivation is wanting to be able to implement something
  akin to lisp-interaction-mode for editing Erlang.
  For other languages, one way this has been achieved is by
  first uploading a TCP server on the VM (cf. nREPL or Nvim-R)
  that responds to editing commands.
  However, Erlang VMs, having first-class support for distributed applications,
  already expose an RPC server by default.
  One just has to communicate with the VM using the Erlang distribution 
  which is what this package implements.
  (This necessitates having implemented processes.)

  As an example of how this is immediately useful: After doing M-x compile RET,

      (derl-do (derl-call (derl-rpc node 'c 'lm ())))

  would reload all modules that changed, on the local node `node'.

See the package commentary for details.

For those familiar with the Distel Emacs package
which implements similar functionality and an "erlang-interaction-mode" on top,
derl is intended to fill the role of being
"the core parts of Distel, had they been rewritten 20 years later."
The derl README expands on the differences between the two libraries.

As you can imagine, it was a lot of fun working on this package.

(On the topic of package naming: The current name stands for Distributed ERLang.
A more fun alternative I was thinking of is "earl",
but I am against any longer names given the compositional nature of the API.)

I have sent a signed copyright assignment but not yet received acknowledgment.
Figured I could open up for review in parallel,
given that asynchronicity is very much the name of the game here.

Kind regards
Axel Forsman

reply via email to

[Prev in Thread] Current Thread [Next in Thread]