all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: John Wiegley <jwiegley@gmail.com>
To: emacs-devel@gnu.org
Subject: Re: async 1.0
Date: Mon, 25 Jun 2012 18:54:53 -0500	[thread overview]
Message-ID: <m262afvtlr.fsf@gmail.com> (raw)
In-Reply-To: <87wr2vzbm7@ch.ristopher.com> (Christopher Schmidt's message of "Mon, 25 Jun 2012 15:53:39 +0100 (BST)")

>>>>> Christopher Schmidt <christopher@ch.ristopher.com> writes:

>>> Other than that, GNU Emacs has excellent asynchronous process and network
>>> facilities already.  Why not use them?
>> 
>> And these would be?  I'm not aware of any core service that lets me
>> asynchronously call lambdas.

> I do not like that you snipped context out of my quotes.

I really am very sorry if I dropped your context.  I didn't meant to
antagonize, just to reduce the length of my reply.

> Why do you want complex forms to be called asynchronously out of the context
> of the original Emacs process?

My core argument for async.el is that certain Emacs primitives, such as
`copy-file' and `process-send-region', cannot benefit from the tricks employed
by packages like deferred.el.  I think deferred.el is an excellent approach to
deferred computation: when things don't need to happen right away, they can be
interleaved with the user's commands as the interpreter becomes available.

But there are cases when Emacs *must* block the main process for minutes at a
time (such as copying a 10G file on my local machine).  It is these cases that
async.el is designed to address.  Otherwise, if deferred.el can solve the
problem, I think it's preferrable to use that over full asynchronicity.  It's
easier to debug with it, behavior is less surprising, and backtraces are more
revealing.

So we actually have many tools in our toolbox.  Async.el would just be one
more, with its own caveats and gotchas.  So far we have:

    1. `start-process'.  Works great, if you have an external executable to
       call.  `copy-file' cannot be made asynchronous using this primitive
       alone, as you cannot depend on the existence of "cp" or "copy.exe" on
       all platforms.

    2. Timers.  This is how deferred.el and a few other packages give the
       semblance of asynchronicity: by returning to the caller immediately,
       and queueing up code to be executed as the interpreter becomes
       available.

    3. Self-hosting (aka async.el), where a child Emacs is spawned to do work
       on behalf of the parent Emacs.

    4. The "concurrency" branch in Emacs Bzr.  I'd really like to know more
       about what's in here, and what problems it creates and solves.

Each of the first three has been used many times over, by many packages.
Eshell uses #1 to make use of external programs asynchronously; el-get (thanks
to Dave Abrahams) used to use #2 to make updates and installs asynchronous;
deferred.el is based on #2; #3 is used by elnode and helm, who rolled their
own implementations of what async.el does.

So async.el does not invent anything new.  The same approach (`start-process'
of a child Emacs) is currently "out there" and being used.  I just wanted to
wrap a simple and generalized interface around this practice, to aid in its
further use.

> The point I was trying to make is that async.el can make development and
> actual end-user usage both simpler and harder.  Some issues could be avoided
> by using non-forking asynchronous I/O in the first place.  "A nice
> short-term solution with severe long-term consequences."  (Now that I looked
> up 'severe' in a dictionary, I think it is the wrong term.  I wanted to say
> that async.el can cause unexpected surprises.)

Yes, this is the bane of asynchronicity in general.  And perhaps the best
argument for why it should always be "opt-in".

> Implementing asynchronous smtp on top of smtpmail within 19 LOC is
> impressive.  No doubt whatsoever.  This is a great opt-in feature.  You did
> not mention opt-in-ness before and to me it was not obvious from the
> context, especially because AFAICT dired-async.el unconditionally redefines
> dired internals to use async.el.

Sorry if I failed to make my position more clear.  I want async.el to be
available to everyone, but by no means do I want to inflict it on everyone
without their consent.  I take a very conservative approach to core Emacs
changes, since this is a platform people use to get real work done.  I _live_
in Emacs; it's core of my professional life.  I wouldn't want it to be
disrupted any more than I would want to do the same to you.

> I am sorry for offending you if that is the case.  I have lots of respect
> for your work.[1]

None taken, Christopher.  I'm just a parent defending his little child. :)

John



  reply	other threads:[~2012-06-25 23:54 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <m2hau86tfk.fsf@vulcan.local.i-did-not-set--mail-host-address--so-tickle-me>
     [not found] ` <E1ShM8F-0006IY-L9@fencepost.gnu.org>
     [not found]   ` <m2txy51z1k.fsf@newartisans.com>
     [not found]     ` <E1ShiKM-0000Aa-5G@fencepost.gnu.org>
2012-06-21 21:23       ` async 1.0 John Wiegley
2012-06-22  7:00         ` Teemu Likonen
2012-06-22 10:54           ` John Wiegley
2012-06-22 12:39             ` Michael Albinus
2012-06-22 22:02               ` John Wiegley
2012-07-04 17:10                 ` Samuel Bronson
2012-07-05  4:09                   ` John Wiegley
2012-07-05 19:58                     ` Samuel Bronson
     [not found]             ` <82d34r8ej9.fsf@gmail.com>
2012-06-22 21:50               ` John Wiegley
2012-06-23  1:44                 ` Stefan Monnier
2012-06-23  3:00                 ` Stefan Monnier
2012-06-23 16:26                   ` Lennart Borgman
2012-06-23 21:08                   ` John Wiegley
2012-06-23 21:28                     ` Jeremiah Dodds
2012-06-23 21:50                     ` Thierry Volpiatto
2012-06-24 15:02                     ` Christopher Schmidt
2012-06-24 15:42                       ` Bastien
2012-06-24 21:01                       ` John Wiegley
2012-06-25 14:53                         ` Christopher Schmidt
2012-06-25 23:54                           ` John Wiegley [this message]
2012-06-24 21:12                       ` ELPA and core services John Wiegley
2012-06-24 21:40                         ` Lennart Borgman
2012-06-25  2:20                         ` Stefan Monnier
2012-06-25  4:39                         ` Stephen J. Turnbull
2012-06-25  6:01                         ` Achim Gratz
2012-07-03 14:38                           ` Tom Tromey
2013-01-22 19:13                             ` Achim Gratz
2012-06-25  4:32                       ` stdlib for Emacs? [was: async 1.0] Stephen J. Turnbull
2012-06-23  6:25                 ` async 1.0 Stephen J. Turnbull
2012-06-23 21:05                   ` John Wiegley
2012-07-01  8:16                   ` Michael Sperber
2012-06-22 11:38         ` Richard Stallman
2012-06-22 21:39           ` John Wiegley
2012-06-22 23:02             ` Richard Stallman
2012-06-23  7:46               ` zwz
2012-06-23 20:49                 ` Richard Stallman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m262afvtlr.fsf@gmail.com \
    --to=jwiegley@gmail.com \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.