From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: John Wiegley Newsgroups: gmane.emacs.devel Subject: Re: async.el: A simple asynchronous framework for Emacs Date: Wed, 20 Jun 2012 03:13:06 -0500 Message-ID: References: <20120620072447.573D613C624@vps1.kiwanami.net> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: dough.gmane.org 1340180057 30156 80.91.229.3 (20 Jun 2012 08:14:17 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Wed, 20 Jun 2012 08:14:17 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Jun 20 10:14:14 2012 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1ShG3H-00014O-I3 for ged-emacs-devel@m.gmane.org; Wed, 20 Jun 2012 10:14:11 +0200 Original-Received: from localhost ([::1]:36632 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ShG3H-0005Qr-GB for ged-emacs-devel@m.gmane.org; Wed, 20 Jun 2012 04:14:11 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:51101) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ShG39-0005Pr-6A for emacs-devel@gnu.org; Wed, 20 Jun 2012 04:14:08 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ShG37-0008Oh-Bo for emacs-devel@gnu.org; Wed, 20 Jun 2012 04:14:02 -0400 Original-Received: from mail-gg0-f169.google.com ([209.85.161.169]:42332) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ShG37-0008OM-4s for emacs-devel@gnu.org; Wed, 20 Jun 2012 04:14:01 -0400 Original-Received: by ggm4 with SMTP id 4so6216690ggm.0 for ; Wed, 20 Jun 2012 01:13:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:subject:references:mail-followup-to:date:in-reply-to :message-id:user-agent:mime-version:content-type; bh=OdLLwmStCBRoAB+BrXspMa5CNHhHFPP1N+B9UFpN0AY=; b=Tp+IwgK87wvJQfmydgz81JTGl3swZH+Q0FVOh2orqka0c1TXYgypNk65a6fKOUk7N6 hSWt1ymahFXkIf1YKO8V/C0liqTWXIJIoPjPevOWM3/QIf6onKNIxfthapRh64lpHNnh mZNhbRX2fbHUg4pY2ye56HRpjmBBeISsUU6MpMf/XTiNWXMYPB2co+HqNqqU9K9SXAzf laenBxZgwgjIAJBlPvGG4HCv0254m7bwdRA77X1EsWCdNuWlLweFqg5/NCP3TEo/wRS1 qyQd03PUiQAdxn+UVwaX2PXFkKnEHL+OLRCiKd1/WWo2imlQxoOAKF5tDTpr+NJyazvv aXyg== Original-Received: by 10.50.17.170 with SMTP id p10mr3724562igd.19.1340180039106; Wed, 20 Jun 2012 01:13:59 -0700 (PDT) Original-Received: from vulcan.local (c-98-215-105-167.hsd1.il.comcast.net. [98.215.105.167]) by mx.google.com with ESMTPS id gs4sm26224066igc.1.2012.06.20.01.13.57 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 20 Jun 2012 01:13:58 -0700 (PDT) Original-Received: by vulcan.local (Postfix, from userid 501) id 3C9C3EFC461C; Wed, 20 Jun 2012 03:13:06 -0500 (CDT) Mail-Followup-To: emacs-devel@gnu.org In-Reply-To: (John Wiegley's message of "Wed, 20 Jun 2012 02:52:44 -0500") User-Agent: Gnus/5.130006 (Ma Gnus v0.6) Emacs/24.1 (darwin) X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 209.85.161.169 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:151047 Archived-At: >>>>> John Wiegley 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