GNU-devel ELPA - futur

futur Atom Feed

Description
Future/promise-based async library
Latest
futur-0.0.20260211.165221.tar (.sig), 2026-Feb-11, 40.0 KiB
Maintainer
Stefan Monnier <monnier@iro.umontreal.ca>
Website
https://elpa.gnu.org/packages/futur.html
Browse ELPA's repository
CGit or Gitweb
Badge

To install this package from Emacs, use package-install or list-packages.

Full description

A library to try and make async programming a bit easier.
This is inspired from Javscript's async/await, Haskell's monads,
and ConcurrentML's events.

You can create trivial futures with `futur-done'.
You can create a "process future" with `futur-process-call'.
And the main way to use futures is to compose them with `futur-let*',
which can be used as follows:

    (futur-let*
        ((cmd (build-arg-list))
         (exitcode <- (futur-process-make :command cmd :buffer t))
         (out (buffer-string))  ;; Get the process's output.
         (cmd2 (build-second-arg-list exitcode out))
         (otherexit <- (futur-process-make :command cmd :buffer t)))
      (buffer-string))

This example builds a future which runs two commands in sequence.
For those rare cases where you really do need to block everything
else and wait for a future to complete, you can
use`futur-blocking-wait-to-get-result'.

New kinds of futures can be constructed from:
- `futur-waiting' to create the actual future.
- `futur-deliver-value' to deliver the value to the future created earlier
  with `futur-waiting'.