From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Philipp Stephani Newsgroups: gmane.emacs.devel Subject: async-await (was: Re: "Asynchronous Requests from Emacs Dynamic Modules") Date: Sun, 1 Nov 2020 21:51:53 +0100 Message-ID: References: <86imarfldb.fsf@akirakyle.com> <86y2jn9j70.fsf@163.com> <83pn4y96ut.fsf@gnu.org> <83lffmhi5y.fsf@gnu.org> <83h7qahe03.fsf@gnu.org> <86ft5ufb95.fsf@akirakyle.com> <831rhegnde.fsf@gnu.org> <86d00yexw7.fsf@akirakyle.com> <837dr5exsq.fsf@gnu.org> <86a6w0omts.fsf@akirakyle.com> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="9150"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Eli Zaretskii , Emacs developers , yyoncho , Stefan Monnier , all_but_last@163.com To: Akira Kyle Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sun Nov 01 21:53:03 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 1kZKLW-0002BS-Fg for ged-emacs-devel@m.gmane-mx.org; Sun, 01 Nov 2020 21:53:02 +0100 Original-Received: from localhost ([::1]:35916 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kZKLV-00015N-GY for ged-emacs-devel@m.gmane-mx.org; Sun, 01 Nov 2020 15:53:01 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:58986) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kZKKd-0000Lz-9h for emacs-devel@gnu.org; Sun, 01 Nov 2020 15:52:07 -0500 Original-Received: from mail-oi1-x229.google.com ([2607:f8b0:4864:20::229]:39994) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kZKKb-0004K7-MP; Sun, 01 Nov 2020 15:52:06 -0500 Original-Received: by mail-oi1-x229.google.com with SMTP id m143so3329858oig.7; Sun, 01 Nov 2020 12:52:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=RLgReMjeF9ca0nlz7OTEWI01HbkLcofrX1VeapAln+A=; b=V+HfWm0uA7e0wLOA30mVBr7QGA3F0pg2RWN/mBM5n762p2kGOPdhMoKq1UJRIXhp43 laFdC51vHOstGP4pUKoXalVbC3u/3hgKZ9XTlH/2EUKLaVy6oTQzmB3jehMnfEKqbnlq CJGKxB/HLETBSabQpC7sA69BLS3ca/4zEldDXLoFKTX0d9y/ploWM3RYnbNVu/sZ4DlI fpmQHhAHOQBsd1qTBUS6NMAMQJS/qLuVqXO9hTg8i0QhK5qE8YkKBA7VWPgMakAiJEtm hMwZcWOkzK5vAHrjvBgUvyoV7dIkguU0eAugKlmsED+48Ha7MXVSupYSKT0O5NcJdbIi ICyQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=RLgReMjeF9ca0nlz7OTEWI01HbkLcofrX1VeapAln+A=; b=POd7YouLzDBsqYqjwN2IFmpP/aTldpOtb5g3QSxyK8VWjc6CFP3Sp8DrYus6taL109 WMSj+bq90cj6JL6M5sZfkHH/g3wNPzMyxxhGnG5pPH7IaLlGD7soyzpw4QVrGnzd8S5W VwVoKJRPTgH4OeZuYQiG4F3v/m0HbpXtJJ7EyRnkPz77T36XghW/tGSR21XD/pJ4SLW4 XdTGys15PGPBh/NxztT0pVTCCIGVgNY5XZ4NC7CvWrPaIZP36uyd5CiOfV1iC2hISBDZ qHJyL4fiMyQzJCK80RFWY6mdlL1UqeO/SwQJa+FiSXTUMs8C3ERsZOgwG+24nS+B40So TLYw== X-Gm-Message-State: AOAM531KlREfqEVhbCIFA3FgpVbOSKvBjpf8JCRdlRaQS1zABYT0iAQ4 ziCejjpsrTJB7CfYyVKcDOhxPVwzpx9eYvjn9Wc= X-Google-Smtp-Source: ABdhPJxvo7R76EhlXZMUkOEfcI5d15GNhsfN2g0uTuJa0nIt5DeV4Pl1h4RppqbfUFlvSglYvLJ5D80B7Y6p0b8c60w= X-Received: by 2002:a05:6808:3af:: with SMTP id n15mr1242898oie.65.1604263924256; Sun, 01 Nov 2020 12:52:04 -0800 (PST) In-Reply-To: <86a6w0omts.fsf@akirakyle.com> Received-SPF: pass client-ip=2607:f8b0:4864:20::229; envelope-from=p.stephani2@gmail.com; helo=mail-oi1-x229.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -17 X-Spam_score: -1.8 X-Spam_bar: - X-Spam_report: (-1.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_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=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.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:258610 Archived-At: Am So., 1. Nov. 2020 um 21:15 Uhr schrieb Akira Kyle : > I think libraries like emacs-aio [1] accomplish the same thing but > with a much easier to use interface. By using (run-at-time 0 nil > callback args) they accomplish a sort of "green threading" that > doesn't actually need any sort of pthread support or the > associated issues with ensuring atomicity with the interpreter. It > would be great to have something like this built in. > > [1] https://github.com/skeeto/emacs-aio I agree (independent of the threading interface and module question) that an async-await model is really nice and powerful. It would indeed be great to better support it in Emacs. The aio library suffers from a few problems (due to Emacs, not due to the library itself), which could be rectified by implementing such support in core Emacs: 1. It makes functions virtually un-debuggable because of the necessary CPS transformations. Either Edebug should be beefed up to understand the CPS state machines, or the state machine generation should somehow happen in core. 2. It makes error reporting from asynchronous functions virtually impossible because the timer machinery catches all errors and converts them into nondescript "error in timer" messages. None of those are impossible to overcome, but they need a bit of design work to fix.