From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Tomas Hlavaty Newsgroups: gmane.emacs.devel Subject: Re: continuation passing in Emacs vs. JUST-THIS-ONE Date: Sat, 25 Mar 2023 22:05:41 +0100 Message-ID: <875yao1qze.fsf@logand.com> References: <627090382.312345.1678539189382@office.mailbox.org> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="28957"; mail-complaints-to="usenet@ciao.gmane.io" To: Thomas Koch , "emacs-devel@gnu.org" Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sat Mar 25 22:06:55 2023 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pgB6F-0007A8-BA for ged-emacs-devel@m.gmane-mx.org; Sat, 25 Mar 2023 22:06:55 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pgB5F-0005Ad-TK; Sat, 25 Mar 2023 17:05:53 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pgB5C-00057m-Gl for emacs-devel@gnu.org; Sat, 25 Mar 2023 17:05:51 -0400 Original-Received: from logand.com ([37.48.87.44]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pgB5A-0002rO-3j for emacs-devel@gnu.org; Sat, 25 Mar 2023 17:05:50 -0400 Original-Received: by logand.com (Postfix, from userid 1001) id 085BB19E65D; Sat, 25 Mar 2023 22:05:43 +0100 (CET) X-Mailer: emacs 28.2 (via feedmail 11-beta-1 I) In-Reply-To: <627090382.312345.1678539189382@office.mailbox.org> Received-SPF: pass client-ip=37.48.87.44; envelope-from=tom@logand.com; helo=logand.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 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-mx.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:304769 Archived-At: On Sat 11 Mar 2023 at 14:53, Thomas Koch wrote: > TL;DR: (Why) is there no standard way for continuation passing > style[1] ("event driven") programming in Emacs? Asynchronous processes take callbacks as arguments. > [1] https://debbugs.gnu.org/61350 > [2] https://debbugs.gnu.org/12145 The problem seems to be that an event was missed and emacs gets stuck waiting in a loop. It is essential in event driven edge trigered push model not to miss events. Moreover, it is a bad idea to loop or wait in filter callback. > Because there is no such library in Emacs, people either write their > own code for continuations (eglot?) or do too much work in a process > filter function (speechd-el in 2004 which led to JUST-THIS-ONE). Yeah, it looks like people tend to do too much stuff in filter callbacks. It is better to keep those simple and do any complex work outside the callback. The code could be written not to do too much work in a process filter function even without such library.