[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Is there any easy way to fork in elisp? Why not?
From: |
Zhiwei Chen |
Subject: |
Re: Is there any easy way to fork in elisp? Why not? |
Date: |
Thu, 28 Oct 2021 20:13:14 +0800 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux) |
Rudi C <rudiwillalwaysloveyou@gmail.com> writes:
> 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.
>
Maybe `async-let'
https://github.com/jwiegley/emacs-async/blob/master/async.el#L405 is what your
want.
--
Zhiwei Chen