I apologize for the delay. I'm honestly not familiar with this section
of the codebase. I took some time to and learn it. My follow ups
should be more timely :P
First of all, thank you very much for this patch! This certainly looks
like a useful feature!
* positional arguments
I think it would make more sense to accept two separate lists, arguments
and header arguments, instead of trying to mix them into one list (via
&rest stuff). Everywhere else seems to have a very clear explicit
distinction between the two and I think we should keep that.
Also you don't have to process the positional args as much as you are.
`org-babel-merge-params' can handle figuring out what value is what arg.
#+begin_src elisp
(org-babel-merge-params
'((:var . "n=4"))
'((:var . "17")))
#+end_src
#+RESULTS:
: ((:var . n=17))
`org-babel-execute-src-block' calls `org-babel-merge-params' internally
so I think you're safe to just pass the pargs as a list that looks like
this:
'((:var . parg1value) (:var . parg2value) ...)
* New var passing syntax
I would like to reduce the scope of this patch a little. You've added a
new way to specify the value of a ":var" using the syntax "('name
. value)". I'm not convinced this is necessary.
While I understand the want to not convert everything to a string and
then later convert it back into an object, I worry that we might break
things. I belive the current code expects the value of ":var" to be a
string.
This new syntax is only available from your function and not when
specified in the header argument so I worry this would also make Org
feel less cohesive.
We can always add something like this in later if there is sufficient
justification. I'm only asking we remove from this current patch.
* Testing
You've added a test case which is wonderful! If possible though I'd like a few
more.
I would like to see some tests for nested calls to `org-babel-call'. Can we
use `org-babel-call' to call source blocks that contain a call to
`org-babel-call'? I think org babel relies on some global variables that might
not like this situation like `org-babel-current-src-block-location'. Your
"fib" example would be a good test but I would also like a test where the
nested call is to a different code block instead of itself.
* nits
The commit message is not formatted how we like. We use the GNU Coding
Standards (https://www.gnu.org/prep/standards/). I know how annoying it is to
read lengthy style guides though so feel free to leave it as is and I'll fix
it.
#+begin_src diff
+,#+name: pydemo
+,#+begin_src python :var user="john" :var field="first-name" :var data=data
+import yaml
+d=yaml.safe_load(data)
+return d[user][field]
+,#+end_src
+
+,#+results: pydemo
+: John
#+end_src
Here you put in "john" and get out "John" which might be a little confusing. I
really like the example you've picked but it might be clearer if the yaml file
had objects "user-1" and "user-2" instead of "john" and "jane".