From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Axel Forsman Newsgroups: gmane.emacs.devel Subject: [ELPA] New package: derl Date: Thu, 21 Sep 2023 10:19:26 +0000 (UTC) Message-ID: <87wmwjygk3.fsf@axelf.se> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="16618"; mail-complaints-to="usenet@ciao.gmane.io" To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Thu Sep 21 12:20:23 2023 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1qjGnH-000471-5c for ged-emacs-devel@m.gmane-mx.org; Thu, 21 Sep 2023 12:20:23 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qjGmR-0006zb-31; Thu, 21 Sep 2023 06:19:31 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qjGmP-0006yH-IP for emacs-devel@gnu.org; Thu, 21 Sep 2023 06:19:29 -0400 Original-Received: from wrqvqshf.outbound-mail.sendgrid.net ([149.72.70.15]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qjGmN-0005fA-OK for emacs-devel@gnu.org; Thu, 21 Sep 2023 06:19:29 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=axelf.se; h=from:cc:subject:mime-version:to:content-type: content-transfer-encoding:cc:content-type:from:subject:to; s=s1; bh=qmIAiNCBAH1gh5ufUqocK95CNEhCJmn++/sEDhGjmZw=; b=dkyYh0OvnWqpYVskUNv02TCiEuvCFqEHR9ac8+7ufpTkRcuka7TSln2GiagvKPulka21 ltGZuPlPJYzQSFnOGNTHke92FM3RfxropUu7vQVGCQ5DekKpJYmoQ5Zla1MNCq6BBVsECJ eZ3+7siJaA1S1gnTDTdZ6z6P6esz/X6r1acKlHTKjaMNXZ6vrEiAMJ0BAT+AALhdcqXTBH 2zRkg9H7RyamOqt++1eu6grpseGrxUnj4xfCZMApgIn4TCOHbcjP5OKZdGIcuHngmQhsIh tiDSnbqKBaIB/YjyFdfJPjEnC6rivKLZNWbP5BD/MWx2X4HX0QEUuuIiNaaoFG7Q== Original-Received: by filterdrecv-d7bbbc8bf-hv8x8 with SMTP id filterdrecv-d7bbbc8bf-hv8x8-1-650C18AE-5 2023-09-21 10:19:26.270431523 +0000 UTC m=+507887.734279064 Original-Received: from localhost (unknown) by geopod-ismtpd-7 (SG) with ESMTP id dGJ88cQ7R5ixE5oQiu8FNg for ; Thu, 21 Sep 2023 10:19:25.835 +0000 (UTC) X-SG-EID: =?us-ascii?Q?a9jmprsm98cnqgHsU2O6rQhtHh4uQUltDI0sfxLQLLW0ScObgxI6amEU2a6U78?= =?us-ascii?Q?W+uzHRizkBAU7fgnp0mXCCVUIRuRhSmDc2p4Nd3?= =?us-ascii?Q?5qagB5fKMzsdc+JTZM7Ydzlb4b6n0XIKArZwIrl?= =?us-ascii?Q?epAH1XccKRfTywkXOC0EWy+llYqKgYdH22PeVRJ?= =?us-ascii?Q?Fmhk=2F+Tm6pk8JbvTwPvqvWVMnksYvGrFOMC1JxZ?= =?us-ascii?Q?gyGYm4dwlx5ierolY=3D?= X-Entity-ID: kO1dOy+IUnMwDrvHlPpg/w== Received-SPF: pass client-ip=149.72.70.15; envelope-from=bounces+28258838-fae1-emacs-devel=gnu.org@em3403.axelf.se; helo=wrqvqshf.outbound-mail.sendgrid.net X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, UNPARSEABLE_RELAY=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:310885 Archived-At: 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