From: Axel Forsman <axel@axelf.se>
To: emacs-devel@gnu.org
Subject: [ELPA] New package: derl
Date: Thu, 21 Sep 2023 10:19:26 +0000 (UTC) [thread overview]
Message-ID: <87wmwjygk3.fsf@axelf.se> (raw)
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
next reply other threads:[~2023-09-21 10:19 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-09-21 10:19 Axel Forsman [this message]
2023-09-21 10:34 ` [ELPA] New package: derl Axel Forsman
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87wmwjygk3.fsf@axelf.se \
--to=axel@axelf.se \
--cc=emacs-devel@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.