From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Ted Zlatanov Newsgroups: gmane.emacs.devel Subject: Re: ELisp futures and continuations/coroutines Date: Thu, 19 May 2011 17:51:20 -0500 Organization: =?utf-8?B?0KLQtdC+0LTQvtGAINCX0LvQsNGC0LDQvdC+0LI=?= @ Cienfuegos Message-ID: <87wrhmuwwn.fsf@lifelogs.com> References: <87fwogaxzb.fsf@stupidchicken.com> <87mxilezg8.fsf@lifelogs.com> <87boz0eov8.fsf@lifelogs.com> <87mxikrulm.fsf@lifelogs.com> <871uzw5asv.fsf@lifelogs.com> <878vu2ztua.fsf_-_@lifelogs.com> <20110519170354.3E15F13C514@vps1.kiwanami.net> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: dough.gmane.org 1305845507 3376 80.91.229.12 (19 May 2011 22:51:47 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Thu, 19 May 2011 22:51:47 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri May 20 00:51:43 2011 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([140.186.70.17]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1QNC4F-0006PZ-8l for ged-emacs-devel@m.gmane.org; Fri, 20 May 2011 00:51:43 +0200 Original-Received: from localhost ([::1]:48709 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QNC4E-0001If-NC for ged-emacs-devel@m.gmane.org; Thu, 19 May 2011 18:51:42 -0400 Original-Received: from eggs.gnu.org ([140.186.70.92]:36404) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QNC4C-0001Ia-ES for emacs-devel@gnu.org; Thu, 19 May 2011 18:51:41 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QNC4A-0007cL-JU for emacs-devel@gnu.org; Thu, 19 May 2011 18:51:40 -0400 Original-Received: from lo.gmane.org ([80.91.229.12]:58068) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QNC4A-0007cH-3g for emacs-devel@gnu.org; Thu, 19 May 2011 18:51:38 -0400 Original-Received: from list by lo.gmane.org with local (Exim 4.69) (envelope-from ) id 1QNC47-0006LW-N2 for emacs-devel@gnu.org; Fri, 20 May 2011 00:51:35 +0200 Original-Received: from 38.98.147.130 ([38.98.147.130]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 20 May 2011 00:51:35 +0200 Original-Received: from tzz by 38.98.147.130 with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 20 May 2011 00:51:35 +0200 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 46 Original-X-Complaints-To: usenet@dough.gmane.org X-Gmane-NNTP-Posting-Host: 38.98.147.130 X-Face: bd.DQ~'29fIs`T_%O%C\g%6jW)yi[zuz6; d4V0`@y-~$#3P_Ng{@m+e4o<4P'#(_GJQ%TT= D}[Ep*b!\e,fBZ'j_+#"Ps?s2!4H2-Y"sx" User-Agent: Gnus/5.110018 (No Gnus v0.18) Emacs/24.0.50 (gnu/linux) Cancel-Lock: sha1:lKhI3sxJa3ovySYEG/UZotPdNNY= X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 80.91.229.12 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:139534 Archived-At: On Fri, 20 May 2011 02:03:54 +0900 SAKURAI Masashi wrote: SM> I have just made an asynchronous library, deferred.el and concurrent.el. SM> deferred.el : https://github.com/kiwanami/emacs-deferred/blob/master/README.markdown SM> concurrent.el : https://github.com/kiwanami/emacs-deferred/blob/master/README-concurrent.markdown SM> deferred.el is inspired by JSDeferred that comes from Mochikit.Async(JS) and Twisted(Python). I looked at the code and it's pretty nice. It needs some small cleanup to be part of Emacs. SM> I have written some applications built on deferred.el and I found it works well. It's a good library, but maybe too complicated for general use. I don't know how the maintainers feel about anaphoric macros and chained futures. The resulting code, while neat, is IMO hard to understand if you don't understand the underlying macros. Also, the library does a lot more than futures, and I think it would be nice to separate just the futures (the `deferred' defstruct). But the way they are implemented currently, the queue implementation is implicit in the future definition itself. SM> I think handling of asynchronous callbacks is getting important for SM> the Emacs in the future. Because the Emacs interpreter is built on SM> the single thread model (Node.js also employs the single thread SM> model), the Emacs Lisp should have a way to write complicated SM> asynchronous codes more easily. I think with lexical closures Emacs is getting closer to true concurrency, which is better than simulating it in a single-threaded way. I like your approach, it's just (like fsm.el) that it's a very specific way of doing things that doesn't fit with the rest of ELisp code, so I don't think it should be the *standard* way to do futures or continuations. This is just my opinion; the Emacs maintainers should say what they think. SM> I would like to include deferred.el in the Emacs package. I'm in favor, it's a good library and more useful in the core than in the GNU ELPA. Ted