emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Tim Cross <theophilusx@gmail.com>
To: emacs-orgmode@gnu.org
Subject: Re: Using exec functions to simplify session code
Date: Fri, 24 Jun 2022 10:53:56 +1000	[thread overview]
Message-ID: <87tu8a7txl.fsf@gmail.com> (raw)
In-Reply-To: <1vlD0t1ffNxmDCckK6W2md-OzxdCEmzV4IIF9Yop-sNhQgF1lg5bgmaTAO4YcS66JoHyTEBUzJiaY4n8g5l_lxWFiaQ4u_a-CKlvMAoOKCM=@protonmail.com>


Ivar Fredholm <freddyholms@protonmail.com> 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. 


  reply	other threads:[~2022-06-24  1:05 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-23 23:57 Using exec functions to simplify session code Ivar Fredholm
2022-06-24  0:53 ` Tim Cross [this message]
2022-06-24  1:31   ` Ivar Fredholm
2022-06-26  4:33     ` Ihor Radchenko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87tu8a7txl.fsf@gmail.com \
    --to=theophilusx@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).