From mboxrd@z Thu Jan 1 00:00:00 1970 From: Leo Alekseyev Subject: Re: org-babel order of evaluation Date: Thu, 12 Jan 2012 16:35:31 -0600 Message-ID: References: <20120112002506.GA26183@BigDog.local> <87y5td7z2t.fsf@gmx.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([140.186.70.92]:58263) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RlTF7-0006UZ-Uy for emacs-orgmode@gnu.org; Thu, 12 Jan 2012 17:35:35 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RlTF6-00005r-Ve for emacs-orgmode@gnu.org; Thu, 12 Jan 2012 17:35:33 -0500 Received: from mail-pz0-f41.google.com ([209.85.210.41]:49264) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RlTF6-00005l-Or for emacs-orgmode@gnu.org; Thu, 12 Jan 2012 17:35:32 -0500 Received: by dakl33 with SMTP id l33so1654699dak.0 for ; Thu, 12 Jan 2012 14:35:32 -0800 (PST) In-Reply-To: <87y5td7z2t.fsf@gmx.com> List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Emacs orgmode >> Therefore, when executing an entire buffer, there is no way to have >> the execution of a call block dependent on the prior execution of a >> source block. >> > > It would be better to make the dependency explicit by passing the > results of the call line as a (potentially unused) variable to the code > block. =A0For example; [snip] > > There is (at least currently) no guarantee that evaluation order will be > buffer order. I've been extremely confused by this in the past; this should be prominently documented. In the long run, I would like to see this behavior changed. One would intuitively expect all the source code in the file to be evaluated in order. This is how it works in pretty much any other interpreter, why should org-babel be different? (I'm a big fan of the principle of least surprise, and this behavior violates it with vengeance :) ) This is particularly nasty because many users start by treating an org-babel file as a fancier version of the original source code with nice annotations and outline levels; typically in a single language. Thus, operationally, there isn't a distinction between tangling the blocks into a single source file and feeding that to the interpreter and running execute on the whole buffer. But then, of course, one might start using named blocks, variables, and #+call directives. It achieves the same effect as writing wrapper functions (or issuing statements like source("somefile")) in the original language. So, when it results in a completely different execution order, it's a huge surprise. Even if this can be fixed by putting dummy dependencies in by hand, this fix seems inelegant and hacky. Is there some deep rationale for the current behavior that I'm not seeing? Are there big obstacles to enforcing ligeral execution order? --Leo