From: John Wiegley <jwiegley@gmail.com>
To: Emacs developers <emacs-devel@gnu.org>
Cc: Sivaram Neelakantan <nsivaram.net@gmail.com>
Subject: Re: async 1.0
Date: Fri, 22 Jun 2012 16:50:35 -0500 [thread overview]
Message-ID: <m2r4t73tjo.fsf@vulcan.local.i-did-not-set--mail-host-address--so-tickle-me> (raw)
In-Reply-To: <82d34r8ej9.fsf@gmail.com> (Sivaram Neelakantan's message of "Fri, 22 Jun 2012 22:33:38 +0530")
>>>>> Sivaram Neelakantan <nsivaram.net@gmail.com> writes:
> As a lowly user of Emacs, is this going to get into the main branch as I
> seem to be doing a lot of stuff in Emacs that makes the wait icon a regular
> screen feature?
Getting async.el into the main branch can happen next week, if Stefan and RMS
approve. But modifying Emacs packages to take advantage of asnynchronicity
would require a lot more time and testing.
One thing that would make async.el _incredibly_ useful would be a `call/cc'
function in Emacs. Then I could write the following:
(defun some-complicated-command ()
(interactive)
(async-start/cc (lambda ()
... do hard processing in a sub-emacs ...)
;; Instead of being called with just the return value, the
;; finish function is now also called with the result of
;; (call/cc) after invoking the sub-Emacs
(lambda (ret cont)
(funcall cont)))
(message "This processing happens *after* the callback is called."))
The difference here is that right now, `async-start' returns to the *caller*
immediately, with finalization code in the callback. If I had `call/cc',
`async-start/cc' would return to the *user* immediately. The callback's only
job would be to call the continuation, which would resume execution of the
stack that has spawned the asynchronous process.
The issue this addresses is that right now, if you call `async-start' when
call stacks are deep (Gnus, Eshell, etc.), the code has to be made aware that
finalization has been moved to a callback function. It essentially has to be
"short-circuited", to know that asynchronicity is involved.
With continuations, we can push the current runtime stack into a variable, pop
back to the Emacs event loop immediately, and then resume that runtime stack
once the asynchronous function has finished executing.
Stefan/Chong: how hard would this be to add? I'm aware we'd have to move away
from reliance on the C stack; but since they were able to make Python
stackless, I wonder how hard it would be to make Emacs Lisp the same?
John
next prev parent reply other threads:[~2012-06-22 21:50 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 [this message]
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
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
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=m2r4t73tjo.fsf@vulcan.local.i-did-not-set--mail-host-address--so-tickle-me \
--to=jwiegley@gmail.com \
--cc=emacs-devel@gnu.org \
--cc=nsivaram.net@gmail.com \
/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 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).