emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: async.el: A simple asynchronous framework for Emacs


From: John Wiegley
Subject: Re: async.el: A simple asynchronous framework for Emacs
Date: Wed, 20 Jun 2012 03:13:06 -0500
User-agent: Gnus/5.130006 (Ma Gnus v0.6) Emacs/24.1 (darwin)

>>>>> John Wiegley <address@hidden> writes:

> I remember seeing you deferred.el a few weeks ago, but it seemed just
> complicated enough that I shied away.  I wanted an interface that was
> literally just one function large, `async-start', since that covers nearly
> all of my real-world use cases.

Looking further, I see that deferred.el and async.el address slightly
different problem domains.  For example, `async-start' creates another Emacs
in which to call the lambda, while deferred.el put the lambda on a timer and
runs it in the parent Emacs.  This means that if it's a heavy internal
function -- like a `copy-file' of 10 gigabytes -- it will still block Emacs,
am I right?

`deferred:process' looks rather nice, and I like how easily you can create a
"pipe" by chaining process calls.  I wish I had had your library while
building Eshell!  That would have made several things much more natural in the
code.

    (deferred:$
      (deferred:process "ls" "-la")
      (deferred:nextc it
        (lambda (x) (message x))))

This is the same as:

    (async-start-process "ls" "ls"
                         (lambda (proc)
                           (message (with-current-buffer (process-buffer proc)
                                      (buffer-string))))
                         "-la")

async.el does not use timers, though it seems that `deferred:process' does,
even though it also uses process sentinels.  Am I reading that correctly?

John



reply via email to

[Prev in Thread] Current Thread [Next in Thread]