emacs-devel
[Top][All Lists]
Advanced

[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 
http://url8156.axelf.se/ls/click?upn=OEjhiLt4EQwBP7BMdu61cV4sca9Texj-2F9QlDxDS4hNCWjgAQWGLdqn-2B5fUreXtnoaWSy_1I2drHf7TOM-2BFjFYSrHxnLAP9jSFTsULAwXlGneTUPLmu2d9Pk5bm6N4OF11FnZiR7swZoQufDaxy9d0u8CjSCSg3d9PEeb8XuirwNj-2BixV11-2BBHV2wpMefxRdXIIf3MzFo-2FSaYwXNok4vHlUvZoDCNEZTdZR5iNC2MXzlbpwNk4Mj4j40xzbyT7pHEOTkoCwWUcMk-2B5eYuLUheZ8-2FLkaQ-3D-3D
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.

      (derl-spawn
       (iter-make
        (! `(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 
protocol,
  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,
  executing

      (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
(http://url8156.axelf.se/ls/click?upn=OEjhiLt4EQwBP7BMdu61cdC-2BCjjzVKZsWkHY-2Bi2gGfARb1n3h24SJ5P-2F8Axvtu-2Fr3h2uLM13zNjih-2B-2BYSA6r9Q-3D-3DciS2_1I2drHf7TOM-2BFjFYSrHxnLAP9jSFTsULAwXlGneTUPLmu2d9Pk5bm6N4OF11FnZiI2wuFZ-2Ffv7UJu1T-2B8XMHDi8IFBKsQeJuwK05YcVyzoRBdzGjW3piKOHUtg1MCQFwyZUtbEQQ-2FNG-2FkxRlt8lSyvjS29VSbUAfFLoZAbFiaYqo14IaXbPbX2-2BHjxKT2UUcSAEp0IaHhH4zpFt55WJ6qg-3D-3D
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]