From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: Philipp Stephani Newsgroups: gmane.emacs.devel Subject: Re: Questions about throw-on-input Date: Thu, 14 May 2020 16:37:38 +0200 Message-ID: References: <8920fe6a-8fe4-addd-c29e-2213850bf974@web.de> <83k11f7v4q.fsf@gnu.org> <835zcy61e9.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="84080"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Alexander Miller , yyoncho , Stefan Monnier , Emacs developers To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Thu May 14 17:10:42 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 1jZFVS-000Lkf-9O for ged-emacs-devel@m.gmane-mx.org; Thu, 14 May 2020 17:10:42 +0200 Original-Received: from localhost ([::1]:41302 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jZFVR-00035k-Ai for ged-emacs-devel@m.gmane-mx.org; Thu, 14 May 2020 11:10:41 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:41992) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jZEzh-0000sr-6s for emacs-devel@gnu.org; Thu, 14 May 2020 10:37:53 -0400 Original-Received: from mail-ot1-x333.google.com ([2607:f8b0:4864:20::333]:45121) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jZEzf-0001Vh-R1; Thu, 14 May 2020 10:37:52 -0400 Original-Received: by mail-ot1-x333.google.com with SMTP id c3so2471402otr.12; Thu, 14 May 2020 07:37:50 -0700 (PDT) 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=asVzGB0SLVKLZihgoKwRB86kT+R2kPWfW5+aF9cBtRE=; b=GIg7Ot7e//iGNv0SVBzuLtMTVaK6tve81fcBJk/M40wpA21T6WozqN/Ti4gtTjBR+t G9L2O2NalVaWTXulKEwxuPeqwQwP/APcaZejE10X6PkeiDbj7Hm1Jt4Z30W7A6pl9njZ x/pBuDwzbtHVWVdb+vsO2tV7Urh9qombh2rfDXHDiKvSWrv4oeTVXsooQdn7k9pYnOVK z3ypVzQyNkIkJkS1TWTOk9D/6DQFZL/hcy2STRvpC/m/buIw/DCm1Wpre46UJFZnTytD u2AVr3rV6VWtSUEDnLcTSD7ZU6M6JU6C+Pb4aNQrB96oXxgU7pMg4HdmGLG6F6F28DV2 TOGg== 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=asVzGB0SLVKLZihgoKwRB86kT+R2kPWfW5+aF9cBtRE=; b=TqrWtIjN0k4jVtZrLP03md+HPl0PNTO06G9wkwSXUtCd2jqZIyUch1vt23e0pLV8+B VePiZ40XLNHV+gJenS003ip5DcWPgOgFZDs0VQ6/H8NNDwa0NjLnEjNjWGLJbD4MCg/J svgM0DUWKkTdMyAHFDFdrwFB4VHPhJlfg3rSNmseRp1soS60zuSZxINMu8SKNmyoHUv2 OkpVKyP/+4piQm6c/OdkJk51n/G0HK/szkxUThRvgIN5AZIrFgplIsOO0FY1afy2Sm+v tQBtlhSpxlkmvDKiVo8iqUDdlx7yltWxWFX5vryy1Mph+C9Hvueja7dBT9Mos9huhXJO 7R2Q== X-Gm-Message-State: AOAM530ndMoGBglPUdg9qZWrXVeRMymkFPxE/X1tjP58EhMcY3iWy8g4 dgLXA3eGrrZ9DiWZFmII8bnARA3itDVlBrj+vww/yg== X-Google-Smtp-Source: ABdhPJyR5KNP2eQXZ/V/NoIYu8XBb1q8XOhRZaHvXmeudVybdLR7WriMakX22flnptVzdW3geMmpoC8tmaFEMBycfy8= X-Received: by 2002:a9d:206b:: with SMTP id n98mr3699332ota.36.1589467069631; Thu, 14 May 2020 07:37:49 -0700 (PDT) In-Reply-To: <835zcy61e9.fsf@gnu.org> Received-SPF: pass client-ip=2607:f8b0:4864:20::333; envelope-from=p.stephani2@gmail.com; helo=mail-ot1-x333.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_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:250250 Archived-At: Am Do., 14. Mai 2020 um 16:24 Uhr schrieb Eli Zaretskii : > > > From: Philipp Stephani > > Date: Thu, 14 May 2020 10:32:44 +0200 > > Cc: Alexander Miller , Emacs developers , > > Stefan Monnier , yyoncho > > > > > Your ideal world seems to be based on an editor design that is very > > > different from what Emacs is. The absolute majority of objects which > > > an average Lisp program manipulates are globally visible -- buffers, > > > windows, frames, global variables, the obarray, etc., and doing that > > > in non-blocking ways is not really trivial. > > > > > > > And that's what I'd call one of the biggest problems in current > > Emacs's design. Much of the development in programming practices over > > the last few decades has been moving away from global mutable state, > > in order to increase robustness and predictability, and also to make > > concurrency without subprocesses possible. > > My point is that adding multithreading to Emacs will need rethinking > and redesigning many core features, so it is a large job. Yes, I fully agree. Just to reiterate, because I think this point can't be stressed enough: It's not possible to just run existing code in background threads and expect it to work. It's also not possible to have the ELisp interpreter yield automatically. Even with a GIL, a yield means that arbitrary state changes (point moving, buffers vanishing, variable values changing, etc.) can happen. Therefore it's crucial that the interpreter yield only at very specific points (roughly those where other asynchronous code is allowed to run, e.g. accept-process-output or sleep-for). Java/C++-style multithreading is simply not possible with the current design of ELisp. I'd therefore recommend to focus on a combination of explicit asynchonicity without multithreading (using continuations or promises) and webworker-style background processing (with complete state isolation and explicit copying of data).