From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp12.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id kCD7IfYNtWLwdwAAbAwnHQ (envelope-from ) for ; Fri, 24 Jun 2022 03:05:58 +0200 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp12.migadu.com with LMTPS id 8FjvIfYNtWJ2OAEAauVa8A (envelope-from ) for ; Fri, 24 Jun 2022 03:05:58 +0200 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id CEA8928993 for ; Fri, 24 Jun 2022 03:05:57 +0200 (CEST) Received: from localhost ([::1]:52684 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o4Xlk-0001id-My for larch@yhetil.org; Thu, 23 Jun 2022 21:05:56 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:36542) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o4Xkj-0001iN-RO for emacs-orgmode@gnu.org; Thu, 23 Jun 2022 21:04:53 -0400 Received: from mail-pg1-x536.google.com ([2607:f8b0:4864:20::536]:41806) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1o4Xki-0003bW-4g for emacs-orgmode@gnu.org; Thu, 23 Jun 2022 21:04:53 -0400 Received: by mail-pg1-x536.google.com with SMTP id 23so982881pgc.8 for ; Thu, 23 Jun 2022 18:04:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=references:user-agent:from:to:subject:date:in-reply-to:message-id :mime-version; bh=bCBOWwHcs68urX/BeGGXhTKHoa1Sl9s5xx8mb1d+ulI=; b=RMEIGecNObV8SxFJNV9aBIhWHizOzu+MhCCFCfO+44ZmPvRxhMshipi/5R/+rMaGks q18tEInJODxGfqIR8smeSXvtgYo39kCYXaydXcvceycreFsi1rsPK9WwICTuOcmTo3f9 95my28uM+QHExcDLkg1eDKupbdWx6FZLHfMLnaQzqe1YZlRMW6Ztqlhos7LgWYeyvf+c 52Pi0b/7ErwLZsThPtudcUbxUz9AVmbEOBi+/3E5pVZcwCAxLgAdlDrbQbOaTbe9uz0m hU0kvlQLQJQC+knOKEp6WVCsyLXApNncWFK/X6HSGzXfFMVIinYVCVPctfdMD4rEvDUG MNVw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:references:user-agent:from:to:subject:date :in-reply-to:message-id:mime-version; bh=bCBOWwHcs68urX/BeGGXhTKHoa1Sl9s5xx8mb1d+ulI=; b=U9S/YR4TOGSIKRe7JKxYFGOHusEwHy6V8V+MSm/bVGRk6ch9yEQMxJ9wP99WBNDeME BlwRUMraJd8sAQ4S34GK+hSCUrYZOAIjEdNF5uprOw617u9JsJzYcsIVBWcgy2zGDNLQ aO/LLM68hpS+8TYknEvc57+WOf+W/Vcjma1S5MVqhnvbdckaAP4pW2o1deAZ5TQwcwRn V1gEh2OxHWKhKBfiCeJAHV9VYHJwDRI4f0dW/cbzor1Pbn26Nl45AnKwEwK3V8BHL/Dw lbGbgoZ49g968+EcrlpUi/FAc1DwxfQJXJawwnnCmKgPotatMo0WAAQSo9Cu4qrLGYFI rL3Q== X-Gm-Message-State: AJIora+qd6QCSyCqpUjwi3jbUV3+BVjhvx4LfEeUkfnJpks0X05mwjhI L5W54vzt8nRwb67U3EVHhar7K/RORyTrrA== X-Google-Smtp-Source: AGRyM1vwHN2buUqLn9uurx0s4jsAN9kNXDGAj7B38huaa2C9lZwauz18X0O8kYOWKro67jX121Ur3g== X-Received: by 2002:a05:6a00:1a08:b0:510:a1db:1a91 with SMTP id g8-20020a056a001a0800b00510a1db1a91mr43221736pfv.69.1656032689463; Thu, 23 Jun 2022 18:04:49 -0700 (PDT) Received: from dingbat (2001-44b8-31f2-bb00-7416-cd5c-e9bb-327b.static.ipv6.internode.on.net. [2001:44b8:31f2:bb00:7416:cd5c:e9bb:327b]) by smtp.gmail.com with ESMTPSA id a5-20020a1709027e4500b0016784c93f23sm402184pln.197.2022.06.23.18.04.48 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Jun 2022 18:04:49 -0700 (PDT) References: <1vlD0t1ffNxmDCckK6W2md-OzxdCEmzV4IIF9Yop-sNhQgF1lg5bgmaTAO4YcS66JoHyTEBUzJiaY4n8g5l_lxWFiaQ4u_a-CKlvMAoOKCM=@protonmail.com> User-agent: mu4e 1.7.28; emacs 29.0.50 From: Tim Cross To: emacs-orgmode@gnu.org Subject: Re: Using exec functions to simplify session code Date: Fri, 24 Jun 2022 10:53:56 +1000 In-reply-to: <1vlD0t1ffNxmDCckK6W2md-OzxdCEmzV4IIF9Yop-sNhQgF1lg5bgmaTAO4YcS66JoHyTEBUzJiaY4n8g5l_lxWFiaQ4u_a-CKlvMAoOKCM=@protonmail.com> Message-ID: <87tu8a7txl.fsf@gmail.com> MIME-Version: 1.0 Content-Type: text/plain Received-SPF: pass client-ip=2607:f8b0:4864:20::536; envelope-from=theophilusx@gmail.com; helo=mail-pg1-x536.google.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-orgmode@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: "Emacs-orgmode" X-Migadu-Flow: FLOW_IN X-Migadu-To: larch@yhetil.org X-Migadu-Country: US ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1656032757; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=bCBOWwHcs68urX/BeGGXhTKHoa1Sl9s5xx8mb1d+ulI=; b=ROGQ06v5e7pGtps8RbZA6nogKU85LDoFF51h/8YTe8RWN27EbMxdPF0Cn2qvkOdbIQvtLu /fmH40EEzBziXTSQSlzLODn0n899RVdZ8SKRQ5AuRJQmWle2ymvFMKxy4X56dQOqGYi639 l0719jB428bux5EpsEaRJdA3XGXQ5AOEYikIcz16ZfKv/BaEYhPDNpJeWiStNgwJZCIWCf GUfKg0LcJFB7FSB03ZM8Sf8N2sEiTf8iT8msDzmM7x1+/LsDqPM4CkGIdpyawUihxc1xIj ILn/RCJsSJlzts43GJvyWXWwq+5TMsgy14ILnOpYblD92l58pHYxMBdqG1mbtw== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1656032757; a=rsa-sha256; cv=none; b=diCIMO4Y2e3oFbSLQaRKuo9HatyWxYOxV6Tk9CQq3momNAGYWJvr+x8HxVjOS0K9dqFXIy 7eC5NKIIFj6AVPkpG1hQ0QUtuiVlxeeYB6ydKRVf32xGpGCmOI5T6+ztKwqdUid7ykMRBs m5Bm8GJZiujYWYUkzi+LC3eMQv8GQPvmcUCr/MGBIX+7eZ0mxXuMNRZ20teSQ2Fk+qgoS2 p6Hcy9iQP9c5iiPoKqTpOROhPr8Sj90w4/JXApaw848o+nu1gZ2N8w95fOs8D6njOz2/9y KDShfXEjoldkeqtjPSrQH3Jdwp2TOH9ksgehIhKgwtHiLV4xwaHIAmjLaLKGBw== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=RMEIGecN; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org" X-Migadu-Spam-Score: -5.46 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=RMEIGecN; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org" X-Migadu-Queue-Id: CEA8928993 X-Spam-Score: -5.46 X-Migadu-Scanner: scn0.migadu.com X-TUID: 0eYwnotXOwfI Ivar Fredholm writes: > I have been browsing the orgmode code and it feels like we have to do a lot to implement sessions. At least for Python > or Julia, I am wondering if we could instantiate an interpreter, and send the code as a single 'exec' or 'include' > command. Other languages like R and groovy also have facilities to run code from a file. I believe this would reduce the > amount of code needing maintenance, as we would only need to manipulate the string to pass to the interpreter based > on the language. If this has been considered before, could someone explain why this approach was not used? > Best, Guacho > I agree that supporting session can be complex, especially with some languages. The big limitation I can see with your suggestion (assuming I understand what your proposing) is that you may not necessarily want to execute all the blocks at once or only execute a block once. For example, I might have an org file with 4 code blocks which I want to all run in the same session. However, I might want to execute each block interactively, not run all four blocks sequentially all in one batch. I might execute block 1, then based on the result/output form that block, execute block 2 or 3, but maybe not both or perhaps I will execute block 2 twice before executing block 3 etc. If you adopt your approach, we would loose that flexibility. The session argument would essentially boil down to execute all code blocks in this file within the same batch rather than execute each one in a separate environment/instance. While this could be a valid interpretation of session, we would need to be sure it was one which all users found agreeable. It is possible, for stability and maintainability, a new definition of session would be acceptable, but it is a change with implications that would need to be managed carefully.