From: Eric Schulte <schulte.eric@gmail.com>
To: Achim Gratz <Stromeko@nexgo.de>
Cc: emacs-orgmode@gnu.org
Subject: Re: [PATCH] * lisp/ob-core.el (org-babel-execute-src-block): insert hash for silent results
Date: Wed, 13 Mar 2013 08:42:45 -0600 [thread overview]
Message-ID: <874ngfe4sx.fsf@gmail.com> (raw)
In-Reply-To: 87mwu8aqf2.fsf@gmail.com
Aaron Ecay <aaronecay@gmail.com> writes:
> Hi Achim,
>
> 2013ko martxoak 10an, Achim Gratz-ek idatzi zuen:
>> But back to my earlier remark about the hash value actually being a
>> signature of the source block and not the result. If I use noweb
>> references, the reference text is cached, not its expansion. See the
>> example below where after the first invocation I change the source block
>> referenced to deliver a different result. That invalidates the cache
>> for direct invocation of that block, but fails to do so for the indirect
>> invocation. If you look at the two result blocks, you see that the same
>> hash is added to two different blocks.
>
> I think this points in the direction of having the notion of
> dependencies among source blocks. This is an idea that knitr
> (http://yihui.name/knitr/) implements. The idea would be to include in
> the hash of a source block X (in addition to all the pieces that are
> already in the hash) the hash of the blocks that X depends on. So in
> your example, the data that generated the hashes beginning 0bd... would
> be made distinct, because they would include in one case the hash
> 6bd... and in the other d8d... .
>
> As in knitr, I think that manual dependency specification (e.g. in the
> header args of the block) should be possible. But it would also be
> possible to automatically infer that a block depends on any block that
> it references via a :var header or noweb reference – which would in turn
> automatically fix the case you discussed.
>
This is what is already taking place. The :var header arguments are
automatically expanded into dependencies between code blocks, and the
results of previous code blocks are included in the hash calculation of
the current code block.
From re-looking at Achim's previous noweb example, it seems that we
currently do *not* include the values of noweb expansions in code block
hash calculations, I think this is a bug which should be fixed.
>
> And when evaluating a block, the dependencies should be (recursively)
> evaluated first, in case any of them has changed.
>
This is exactly what happens currently with previous blocks referenced
through :var header arguments.
>
> Is it clear what I am describing, and do you have thoughts on it?
>
Very, thank you for spelling it out. I believe that given the bug fix
just mentioned, the current model indeed does support automatic
inference of dependencies between blocks.
>
>>
>>> If one did want to move hashes to code blocks it would be a major
>>> refactoring which would (in my opinion) require significant
>>> justification.
>>
>> I'm not disputing that it requires significant effort. The benefits
>> would be that we might have a chance to clear up some confusion over the
>> code execution model of Babel and better support different ones.
>
> FWIW, I think that hashes shouldn’t be stored in the buffer text at
> all.
To echo Achim's response, you've accidentally uttered Org-mode heresy.
A core design principle is that everything be represented as plain text
in the buffer. That said, the hashes should be largely hidden by
default, and the degree of hiding can be controlled by the
`org-babel-hash-show' variable.
>
> They’re not really part of the document data or metadata. Rather,
> they are information about how the content of the document (code and
> its results) was instantiated/computed in a particular
> environment/occasion. I’d rather see them stored in a lisp data
> structure. They could be written out to an invisible file when the
> org buffer is saved, and re-read on load.
>
>> Oh yes, there's a whole set of _other_ problems that are waiting to be
>> solved. :-)
>
> There always is. :-)
I think Org-mode already provides the bulk of what is desired. If we
agree to treat ":cache yes :results none" as obviously taking place for
side effects, and then sticking a hash behind the :cache header argument
with the code block, then what functionality would be missing?
Thanks,
--
Eric Schulte
http://cs.unm.edu/~eschulte
next prev parent reply other threads:[~2013-03-13 14:46 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-03-06 4:07 [PATCH] * lisp/ob-core.el (org-babel-execute-src-block): insert hash for silent results Aaron Ecay
2013-03-08 21:25 ` Aaron Ecay
2013-03-08 22:07 ` Eric Schulte
2013-03-08 21:53 ` Achim Gratz
2013-03-08 22:09 ` Eric Schulte
2013-03-08 22:24 ` aaronecay
2013-03-09 17:45 ` Eric Schulte
2013-03-09 18:56 ` Aaron Ecay
2013-03-09 20:03 ` Achim Gratz
2013-03-09 0:57 ` Achim Gratz
2013-03-09 18:35 ` Eric Schulte
2013-03-09 19:22 ` Aaron Ecay
2013-03-09 20:26 ` Eric Schulte
2013-03-13 3:55 ` Aaron Ecay
2013-03-13 14:45 ` Eric Schulte
2013-03-19 4:49 ` Aaron Ecay
2013-03-23 22:34 ` Eric Schulte
2013-04-01 5:10 ` Aaron Ecay
2013-04-02 22:14 ` Eric Schulte
2013-03-10 8:52 ` Achim Gratz
2013-03-10 20:14 ` Sebastien Vauban
2013-03-10 21:06 ` Achim Gratz
2013-03-13 4:12 ` Aaron Ecay
2013-03-13 7:50 ` Achim Gratz
2013-03-13 14:42 ` Eric Schulte [this message]
2013-03-13 18:25 ` Achim Gratz
2013-03-14 19:52 ` Eric Schulte
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=874ngfe4sx.fsf@gmail.com \
--to=schulte.eric@gmail.com \
--cc=Stromeko@nexgo.de \
--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).