From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2 ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id CANjCvIEWGDKDQAA0tVLHw (envelope-from ) for ; Mon, 22 Mar 2021 02:46:10 +0000 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2 with LMTPS id MBIrBvIEWGBiYwAAB5/wlQ (envelope-from ) for ; Mon, 22 Mar 2021 02:46:10 +0000 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 D46112FA23 for ; Mon, 22 Mar 2021 03:46:08 +0100 (CET) Received: from localhost ([::1]:50266 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lOAZy-0002eI-Sw for larch@yhetil.org; Sun, 21 Mar 2021 22:46:06 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:60774) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lOAYx-0002dz-1h for emacs-orgmode@gnu.org; Sun, 21 Mar 2021 22:45:03 -0400 Received: from gateway24.websitewelcome.com ([192.185.51.56]:31139) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lOAYr-0007GQ-TJ for emacs-orgmode@gnu.org; Sun, 21 Mar 2021 22:44:59 -0400 Received: from cm10.websitewelcome.com (cm10.websitewelcome.com [100.42.49.4]) by gateway24.websitewelcome.com (Postfix) with ESMTP id 3F9359C41 for ; Sun, 21 Mar 2021 21:44:45 -0500 (CDT) Received: from box2035.bluehost.com ([74.220.219.237]) by cmsmtp with SMTP id OAYelBEzmL7DmOAYfljEfa; Sun, 21 Mar 2021 21:44:45 -0500 X-Authority-Reason: nr=8 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tsdye.online; s=default; h=Content-Transfer-Encoding:Content-Type: MIME-Version:Message-ID:Date:In-reply-to:Subject:To:From:References:Sender: Reply-To:Cc:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=XZdHqBnrQZe/Bg6kfCSnQ8g3H2FfcUcU8QazHDNi228=; b=QJBjmAbMY/PV10l7rpfeYVlY1q wOcPOguQJo0aASRIDx3Deb5H/ftAGioWxe+GQjSnvOCLD3Jl1qG0tcPtXWUl0SOa+PIBFxWwPv5/3 LRRDUqRTx0cZCg+s+crY5BpZRi9mXywdtGmAu49XMW4p0qnYoo/d4sBBRGhv/lekHyZK80fjFG5gm bCwO7ROHIO0kj1hbUThHPhUnszlfj2Iox42VFvzr8ISiYbWO0+wzetvytE3Z5HOCoTgeQr0Wt6opd 9Bia5LAg40e58g/oPKrfzH2jlX1lZh9bbfCF694bhnzxH0eZZZLx/A6GUeu3yNESOAORjZSfa4wDf iuRV9a1A==; Received: from cpe-50-113-36-248.hawaii.res.rr.com ([50.113.36.248]:36246 helo=manifi.tsdye.online) by box2035.bluehost.com with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.93) (envelope-from ) id 1lOAYe-000tfn-FQ for emacs-orgmode@gnu.org; Sun, 21 Mar 2021 20:44:44 -0600 References: <87k0q0ymk1.fsf@riseup.net> User-agent: mu4e 1.2.0; emacs 26.3 From: "Thomas S. Dye" To: emacs-orgmode@gnu.org Subject: Re: source blocks DAG evaluation In-reply-to: <87k0q0ymk1.fsf@riseup.net> Date: Sun, 21 Mar 2021 16:44:36 -1000 Message-ID: <8735wnsy97.fsf@tsdye.online> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: quoted-printable X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - box2035.bluehost.com X-AntiAbuse: Original Domain - gnu.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - tsdye.online X-BWhitelist: no X-Source-IP: 50.113.36.248 X-Source-L: No X-Exim-ID: 1lOAYe-000tfn-FQ X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: cpe-50-113-36-248.hawaii.res.rr.com (manifi.tsdye.online) [50.113.36.248]:36246 X-Source-Auth: tsd@tsdye.online X-Email-Count: 1 X-Source-Cap: dHNkeWVvbmw7dHNkeWVvbmw7Ym94MjAzNS5ibHVlaG9zdC5jb20= X-Local-Domain: yes Received-SPF: pass client-ip=192.185.51.56; envelope-from=tsd@tsdye.online; helo=gateway24.websitewelcome.com X-Spam_score_int: 4 X-Spam_score: 0.4 X-Spam_bar: / X-Spam_report: (0.4 / 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, FROM_SUSPICIOUS_NTLD=0.499, PDS_OTHER_BAD_TLD=1.999, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-orgmode@gnu.org X-Mailman-Version: 2.1.23 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 ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1616381169; 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: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post:dkim-signature; bh=XZdHqBnrQZe/Bg6kfCSnQ8g3H2FfcUcU8QazHDNi228=; b=qrUxk3/HF3d+jlU1dbM0nI7uIJFXQC7xyCg094TrjfrE6zSO7xVQpKtqQbq2rwVV1GMyJG 1+CZsDBOAHdOU72FAI+Slur9ChshovnkrSbGlhWFkQL6XBV+rcYxaKif2q9LPH9OT213n2 Z1E8++lZrmByUwGuehssoNbpS1wflcMYyURPoYpUygLmQXdIvaaE1sMBmjQ/A4tF6LD0E8 dF6wG6QLzJTEDAhJ/NdsczgRJPgRZNM/IrwqP5YCJD/cZzn3/EDR8Lu4wz6fxjvMmmVlzQ olYGhKqvcVkjZpit3HixZkWzjEuBzhYHn+A7e+SPDyDb4C7OKC0bYeql7ZflrA== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1616381169; a=rsa-sha256; cv=none; b=LmvRT4Lpgk/4EOLNns6Tz9LOHfIAh39Bi5esSQdxbrLy9dVkXW+90L/UrcDuuv1WmwePeL zsPYgLwqJwJ/aaASlwTs9xa1WUxQzSESgJnJKBTLmJym17p63yvk4OXkrlNzX/SvwUNbmP E/97dedG6YCkcyXcFIjIf4apuCRlUspFAMxXCMVsClOWB0lA+WvVuUcH2tFRcpqsPyFOOR YzqTaQX9cly8VBhl1kimFCdy7T15tf7P+zFE3UklizZeQHYwhHk00NIjvQgKxouUwg3Mei SfvARJCPtcVow1TCJwqmI0axeFA+PZV32SNayzRuf58ak4RmmwmGCl7K68QRUw== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=tsdye.online header.s=default header.b=QJBjmAbM; spf=pass (aspmx1.migadu.com: domain of emacs-orgmode-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=emacs-orgmode-bounces@gnu.org X-Migadu-Spam-Score: -1.42 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=tsdye.online header.s=default header.b=QJBjmAbM; dmarc=none; spf=pass (aspmx1.migadu.com: domain of emacs-orgmode-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=emacs-orgmode-bounces@gnu.org X-Migadu-Queue-Id: D46112FA23 X-Spam-Score: -1.42 X-Migadu-Scanner: scn0.migadu.com X-TUID: vX25lSugbLo6 Aloha c4to, I would be tempted to use noweb expansion here. #+name: libB #+begin_src scheme :results none :noweb yes <> (define greetings (string-append hi ", " "to all the people!")) #+end_src #+begin_src scheme :session example :results output :noweb yes <> (display greetings) #+end_src Does this do what you want? All the best, Tom c4t0 writes: > Hi, > > Is it possible to have a dependency hierarchy of source blocks? > > i.e.: in C, if you use libA from a compilation unit and that=20 > library needs libB, you don't need to include it in main.c > > -> main.c > #include "libB.h" > -> libB.c > #include "libA.h" > > you don't need to: > -> main.c > #include "libB.h" > #include "libA.h" > > because library headers are closed under inclusion. > > I haven't succeeded in doing the same in org-mode. Even after=20 > populating org-babel-library-of-babel. > > Using #+call just doesn't work. Using :var is better, evaluates=20 > all, but there appears to lack session support, it doesn't check=20 > for cycles and it feels a little hacky > > With #+call I need to do it like this: > > #+name: libA > #+begin_src scheme :results none > (define hi "hello") > #+end_src > > #+name: libB > #+begin_src scheme :results none > (define greetings (string-append hi ", " "to all the people!")) > #+end_src > > here is my "main" I need to C-c C-c in each #+call line and=20 > write the :session that the code block uses in each one, and do=20 > it in the correct order. If I C-c C-c in libB first it won't=20 > eval because 'hi' is not defined. > > #+call: libB[:session example] > #+call: libA[:session example] > #+begin_src scheme :session example :results output > (display greetings) > #+end_src > > source blocks can be #+call(ed) but aren't closed under #+call=20 > (a source block can be called but then the callee won't) > > instead I would like to : > > #+name: libA > #+begin_src scheme :results none > (define hi "hello") > #+end_src > > #+call: libA > #+name: libB > #+begin_src scheme :results none > (define greetings (string-append hi ", " "to all the people!")) > #+end_src > > #+call: libB > #+begin_src scheme :session example :results output > (display greetings) > #+end_src > > - there shouldn't be needed to C-c C-c in the #+call line,=20 > evaluating the source block alone should suffice. > - there shouldn't be a need to write the :session > - it should use the session of the user evaled block, unless=20 > specified otherwise > > In the other hand, using :var with a dummy variable: > > #+name: libA > #+begin_src scheme :results none > (define hi "hello") > #+end_src > > #+name: libB > #+begin_src scheme :results none :var _=3DlibA > (define greetings (string-append hi ", " "to all the people!")) > #+end_src > > #+HEADER: :var _=3DlibB > #+begin_src scheme :session example :results output > (display greetings) > #+end_src > > It evals libA then libB and finally the (display greetings)=20 > code. > But it fails, because the :session example is ignored. Even if I=20 > add a :session example to every source block (which would be=20 > really bad, sessi=C3=B3n must be decided by the consumer) it doesn't=20 > work. I think that is because :var expects a value, so it just=20 > opens a new session to evaluate code every time. > > Besides if there are any dependency cycles, it just fails with:=20 > Lisp nesting exceeds =E2=80=98max-lisp-eval-depth=E2=80=99 > > So if I'm right and there is not an implemented way to do this,=20 > how can we do it? Adding session support for :var? constructing=20 > a DAG of #+calls and then evaluating in order? maybe using a new=20 > header? > > COD. -- Thomas S. Dye https://tsdye.online/tsdye