From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: Michael Heerdegen Newsgroups: gmane.emacs.devel Subject: Re: Questions about throw-on-input Date: Tue, 12 May 2020 06:15:00 +0200 Message-ID: <875zd1rdq3.fsf@web.de> References: <87r1vwxktw.fsf@gmail.com> <831rnvly58.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="65687"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) Cc: Eli Zaretskii , yyoncho , emacs-devel To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Tue May 12 06:17:54 2020 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 1jYMMc-000H0o-NP for ged-emacs-devel@m.gmane-mx.org; Tue, 12 May 2020 06:17:54 +0200 Original-Received: from localhost ([::1]:36164 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jYMMb-0007SG-GH for ged-emacs-devel@m.gmane-mx.org; Tue, 12 May 2020 00:17:53 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:34858) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jYMJy-0006gE-9d for emacs-devel@gnu.org; Tue, 12 May 2020 00:15:10 -0400 Original-Received: from mout.web.de ([212.227.15.4]:47635) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jYMJx-0000Ln-6R; Tue, 12 May 2020 00:15:09 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=web.de; s=dbaedf251592; t=1589256902; bh=wNuTkYnGzLLjMBi6Td5bYKhIh8Qqr8Knm+6LUpLnK84=; h=X-UI-Sender-Class:From:To:Cc:Subject:References:Date:In-Reply-To; b=POmfLjXCF0HAzQBT3m1ZagFlBh92PUq8QY7Foe7jfJfv9O2qpTmKrojIXlCvSRoel RVOZ3gzsxKs5M7n/2m1C6gySJ8J71BqB+k1j5fG7kN2Mhl/AqYGrTphCWTQMQxttHG 7g8BwTJnE7xiCx7/ZSX3YsRB5/cbopbBvuk/WqvM= X-UI-Sender-Class: c548c8c5-30a9-4db5-a2e7-cb6cb037b8f9 Original-Received: from drachen.dragon ([88.67.107.170]) by smtp.web.de (mrweb006 [213.165.67.108]) with ESMTPSA (Nemesis) id 1MAtsj-1jNbtE3VJh-00BLaR; Tue, 12 May 2020 06:15:01 +0200 In-Reply-To: (Stefan Monnier's message of "Thu, 07 May 2020 21:58:58 -0400") X-Provags-ID: V03:K1:AFpi7HGgX/3BZm/w2qv3l14WUywMZn0sOTFrMhMoKpM8bmGOhd+ DAkW5yseFXoQYVlHor5gLC5V2ev+H6J1GDLeax/O6FA0i+jW4gJNa0clf8bnD5QQlS4nj2l w7Tev23LPcjmfjf+YuS+PVn92xZumztRJf7Hs8u+s6G+EX6c4iWRUgx01KIfP1agxgSNkgG TZB9oqZu34ExnzCYIeZAw== X-UI-Out-Filterresults: notjunk:1;V03:K0:YxB50VU3VP8=:x8LP4chOa5K1iAFYZ5FjnS hzbKxByANGeUdqGzJqbnYhmKPfcZ4Db1mayNiu+eJtoqIad2fPxreWyGMIGIw3mxsOaohx0c2 +R92/+V4LrHncEVEVmSyRtivf2wrPfZfdfeAlmyeUEEEbapVlFg2tWfTrt+TzW6c0uwUkunRn rnPG6Nrg6yYtYFaJswAhivvOXMc3alJJRfwbn109Dy9GQTHYe36JnMtFkDW7GGtPE66FV6fPv xuHbISzeFrLF3zVQ0pm8oPpW1W7KBizYWNec4JzxbyvVYdkgn4CiYjnmULwvLtReljrvRM2Bq +Da6Qve9n1EI05QRiqmbTt3Dt62W11BJl03vavTTP7LnqnbdX/PtJZ39DXdT/yopsrJeCI1o6 wUFDHWQ8gXW8SsC1IOiWK2D7KVdN/u+Ksr6UkVoWu2mY0RVLv0MXvlssybtbzM2Y4k4oPE8tS 60UaHbT6iHwo6Lu70enDoKvjGrbTcWUmNCPdNq+NgSliD7bQB13blmHzVSFGOLdQedfKrJCzB dyPcsIbbcLUKiFJUBUrE5Ft5xEeBoBNZ5nssY0++sPqDgebv8o5N09UHNykcPhsTUtDD/nT/i 2WlY4LYl0q7ZMAaZjeq2DSmxkFD4wZMoBxA6i7snlGgWMQVM3N//J5G3jQsLA4UM+p6EKATet rfIatLnyJCYA0Qz3Q99W7GJhxA1T6dKLfCZNlzcLSfVHaFVgGxKYz9XlxuvrOc+02X8A7MvSX iHk41eO14MAGaj6KZ0TT/N4erlZ7h9n6czLyDKCbsdJV+x6lg/z70dgAdujuF4L1jd3ugsgR Received-SPF: pass client-ip=212.227.15.4; envelope-from=michael_heerdegen@web.de; helo=mout.web.de X-detected-operating-system: by eggs.gnu.org: First seen = 2020/05/12 00:15:05 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 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_LOW=-0.7, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 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" Xref: news.gmane.io gmane.emacs.devel:249938 Archived-At: Stefan Monnier writes: > It can be implemented, but it won't have the desired semantics. > If you want something robust you have 2 options: > > - write in an event-driven style (or CPS style) so that you can easily > stop at various points in the program and stash the rest of the > computation for later. > > - use a thread (which will basically do the same, but transparently, > i.e. without the awkward programming style.) Another variant that may fit sometimes is using stream.el streams. They have state (via lexical binding/closures), but you are also forced to use a certain style that may not work well for every problem, but it is very simple. The actual program then successively generates the elements of the stream in a `while-no-input'. Michael.