From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Po Lu Newsgroups: gmane.emacs.devel Subject: Re: continuation passing in Emacs vs. JUST-THIS-ONE Date: Tue, 18 Apr 2023 17:52:33 +0800 Message-ID: References: <627090382.312345.1678539189382@office.mailbox.org> <87sfe7suog.fsf@gmail.com> <1c6fedae-10b4-5d97-5036-eaa736e1b816@gmail.com> <87mt4c6xju.fsf@logand.com> <87a6001xm0.fsf@logand.com> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="2733"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: Stefan Monnier , Lynn Winebarger , Tomas Hlavaty , Karthik Chikmagalur , Thomas Koch , "emacs-devel@gnu.org" To: Jim Porter Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Tue Apr 18 11:55:18 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 1poi3S-0000QT-5n for ged-emacs-devel@m.gmane-mx.org; Tue, 18 Apr 2023 11:55:18 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1poi36-0002Sz-7t; Tue, 18 Apr 2023 05:54:56 -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 1poi34-0002SZ-8k for emacs-devel@gnu.org; Tue, 18 Apr 2023 05:54:54 -0400 Original-Received: from sonic315-49.consmr.mail.ne1.yahoo.com ([66.163.190.175]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1poi32-00067d-2d for emacs-devel@gnu.org; Tue, 18 Apr 2023 05:54:54 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1681811689; bh=e8cBgZUa4tWp1hbCrvp6587QGbkl+NZterblUyOQ9E8=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From:Subject:Reply-To; b=P0CUOaY7F0mets3sbXgmtOExZY66mdtJ+SN6iuhea67mZ5YtasnVGtKWGkonYB5EoCz3ffF3tir1DBc9mnqsMrI7G2ghQB+OdRCeN12GHYTaBZJbrdNxH1rK+AlLwybujDiAprgtOA9iQrFur3QxPiMuAn9lQqaEd0w2kuu0ahJpOIDf+Mn5zGKGYidepxOwOoWrrpzFtwrzOA4gwLOLTglhHFuwHdi5Qb6lMAEev8Ap2a86PXB4kELir5T2qd8rSsKHNuj7CuofSFqxRbqKY8PcDwqq+bQZm3TCBJONWR3FUedqDpSz0grX2A4iRjxwoeu446Nj06Iw8Jjjaq+oHw== X-SONIC-DKIM-SIGN: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1681811689; bh=GQlTDTTbN/qXIHYacAen9FRbz0mjYExNrAj50hMOAqf=; h=X-Sonic-MF:From:To:Subject:Date:From:Subject; b=J7Nd0YoNJwnjkzYAbmSEpE+ozai7hmEAIdePlh1frz5gdExrpIUN0xTkwH+gL/RorYX8dX5Aqwhh6ts6iA+ukm0T2WNLR9VsRdz09TkBFUtOleEz2WZ5vxtSN/Qm5b33exQrmh4Y2iCfbM14kE9evr1ce1r7STY7Rs11FRvyWBoOr12tPUbP6abeY6OLWNhh8wq7wYTSbCVJACUJOvEMKaWS++hTep5XtwppWWQ+I917tKOiAF2RYtI6f3FhbCY1gQpj+yy0KyN2PFgfr3Dxexxo3dtkCEvZTqUupcCVDHIIMDn4XCKmAiCCi98IxuC264g163KKx7uVLVM0Gs14QQ== X-YMail-OSG: Y2ldBhMVM1m5IhaAK6fLP_6x8Ytj4.mdWS2wjnFsyJqUS24ZStfznEJDg.Qwtol o5JkJ3TP4lBTZ9wdKmT6cLAQwTWtGwZHTF5yCi7ccm248JwWY1sE72dDUhJ4xaMHI265WDVPXvrC Qi6Cu3au54KWh8ENt1Vt0dNLegzNPWtkLDGbIjihsrIcEzC967yy_OG2jTGFczj69joeo4pGcxPk 3DG.DBeb8nv.BVqy07orPMo.IPU7KPVSHSmW42Fgw4peO_IUi21_5vS.zyvdf1ZckZ_BveMm7nJl V99HVk3rfAsKk9AVIY8WVAbhPDY7TcN7lCvcGWqY2Tem7lrG6q7lgc4J5R_l8br2wyf2aPUvaV6H zzUCjbQ1Sy_mKQnxM1JhoYL_SaiMqb8rQBLcNtHpn94v9u4z1_Q3CG5rcT3J2_i6IZY_sI2jF7uR EJLocaZGWSdiu63.6hWQwHELK5b9sAWVBTEPEno52bzj2Gutr2bfdBwTpsfZ0TYB7mQ.naOSxC1j G19wiHj4B36oiu5u_2qOHG4Ug_1nDLuQlqPO2SwsuMFRrC.fRxTRZKAg7nmewMdv8SmuHi6z_1aJ gtWUEUZGtGuug6Wi7RP61jSyxWqXZNlF7qJF.xnpz.7BjJdUsy0YWhCt_M69rtUciS97nF8KH0HB 9FcxMu8Q_MZct8t0EGIC0HyQAll.qvKMm.JSAsK7gF6E.0EjqsNxWHHVjQoDsQnV2XflRykB3E57 q5jhIFt7ysMGKtl0xIsfbiWGiSACAtsKmPQio3N1elIxC.0fwk1M2ampUvBkN8haXMQj324Eix5E QpGbxFwiAWgHqDmsNS5nQECXsJIady6.uW3P6R0KrW X-Sonic-MF: X-Sonic-ID: d14b03c6-a303-4862-b794-81af2f5c1809 Original-Received: from sonic.gate.mail.ne1.yahoo.com by sonic315.consmr.mail.ne1.yahoo.com with HTTP; Tue, 18 Apr 2023 09:54:49 +0000 Original-Received: by hermes--production-sg3-6d6fb994f6-djl48 (Yahoo Inc. Hermes SMTP Server) with ESMTPA ID 7d02d89c7cba2c93e77f9ffc46ba9a0c; Tue, 18 Apr 2023 09:52:42 +0000 (UTC) In-Reply-To: (Jim Porter's message of "Mon, 17 Apr 2023 23:19:38 -0700") X-Mailer: WebService/1.1.21365 mail.backend.jedi.jws.acl:role.jedi.acl.token.atz.jws.hermes.yahoo Received-SPF: pass client-ip=66.163.190.175; envelope-from=luangruo@yahoo.com; helo=sonic315-49.consmr.mail.ne1.yahoo.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 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:305402 Archived-At: Jim Porter writes: > On 4/17/2023 12:50 PM, Stefan Monnier wrote: >>> This whole thread seems to echo the difference between "stackless" >>> and >>> "stackful" coroutines discussed in >>> https://nullprogram.com/blog/2019/03/10/ by the author of >>> emacs-aio, >>> with generator-style rewriting corresponding to stackless and >>> threads >>> to "stackful". So when you say "save as much as threads do", I'm >>> not >>> clear if you're talking about rewriting code to essentially create >>> a >>> heap allocated version of the same information that a thread has in >>> the form of its stack, or something more limited like some >>> particular >>> set of special bindings. >> Indeed to "save as much as threads do" we'd have to essentially >> create >> a heap allocated version of the same info. >> [ I don't think that's what we want. ] > > I think this subthread is about two different aspects, which is > probably due in part to me not distinguishing the two enough > initially; one of the reasons I'd find it useful to "save as much as > threads do" is so that there could be a path towards packaging tasks > up to run on another thread, and for them to eventually have enough > context that we could run multiple packaged tasks > *concurrently*. That's separate from a more-general asynchronous > programming library (though they would likely interact with one > another). > > Javascript might be a useful analogue here, since it too was > originally single-threaded with an event loop, and more concurrency > features were added in later. Similarly to "modern" JS, we could have > async/await constructs that (primarily) work on the main thread, plus > something similar to web workers, which operate as mostly-independent > threads that you can communicate with via messages. Btw, even though I don't know exactly what this is about, ISTM that whatever you're doing could use a name that isn't missing a letter, like `future'. Why `futur'?