unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Is there any easy way to fork in elisp? Why not?
@ 2021-10-26 12:44 Rudi C
  2021-10-28 12:13 ` Zhiwei Chen
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Rudi C @ 2021-10-26 12:44 UTC (permalink / raw)
  To: emacs-devel

[-- Attachment #1: Type: text/plain, Size: 1486 bytes --]

There are some scripts that I find convenient to code in elisp,  and I like
to be able to run these with little startup time.

The natural solution is to use `emacs --batch --eval` together with
`server-eval-at` to reuse an already loaded server, but this solution needs
a lot of throwaway servers already started and a load balancer. (Is there a
Jupyter kernel for elisp? I already have a prototype server (
https://github.com/NightMachinary/JupyterGarden) that starts throwaway
Jupyter kernels and load-balances requests to them.)

If the server could just fork, eval the request, return it, and die,
everything would be easy and painless.

The fork API could be:
```
(let-fork ((some_val (expensive_compute)) ...)
 (lambda()
   (message "Computed: %s" some_val)))
```
Where emacs forks for every binding, and computes the results, and finally,
asynchronously calls the supplied callback function with all of the
bindings available, similar to a closure.

I am sure there are better API designs, but my point is that this fork API
should be very easy and work with synchronous third-party code, just like a
shell (or GNU Parallel). Parallelism via multiprocessing should be easy and
painless.

The third-party packages for parallelism that I have skimmed, start a fresh
emacs instance, and do not fork, which is useless, as all the needed data
and behavior needs to be manually reloaded by the user.

PS: Please use reply-to-all, I am not currently subscribed to the list.
Thank you.

[-- Attachment #2: Type: text/html, Size: 1798 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2021-11-02  3:55 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-10-26 12:44 Is there any easy way to fork in elisp? Why not? Rudi C
2021-10-28 12:13 ` Zhiwei Chen
2021-10-28 22:06 ` Stefan Monnier
2021-10-28 22:16   ` Rudi C
2021-10-30  6:52     ` Richard Stallman
2021-10-31 10:34 ` Philipp
2021-11-02  3:55   ` Richard Stallman

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).