From mboxrd@z Thu Jan 1 00:00:00 1970 From: Aaron Ecay Subject: Re: Difference :header-args: and :header-args+:? Date: Mon, 08 Sep 2014 18:05:26 -0400 Message-ID: <87r3zlrcnt.fsf@gmail.com> References: <877g1j1gwx.fsf@gmail.com> <87vbp1r1fk.fsf@gmail.com> <87sik29ogv.fsf@Rainer.invalid> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:49146) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XR742-0007Vb-Qk for emacs-orgmode@gnu.org; Mon, 08 Sep 2014 18:05:36 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XR740-0007ld-LF for emacs-orgmode@gnu.org; Mon, 08 Sep 2014 18:05:34 -0400 Received: from mail-qa0-x22b.google.com ([2607:f8b0:400d:c00::22b]:63721) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XR740-0007jt-7a for emacs-orgmode@gnu.org; Mon, 08 Sep 2014 18:05:32 -0400 Received: by mail-qa0-f43.google.com with SMTP id cm18so14954779qab.30 for ; Mon, 08 Sep 2014 15:05:30 -0700 (PDT) In-Reply-To: <87sik29ogv.fsf@Rainer.invalid> 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: Achim Gratz , emacs-orgmode@gnu.org --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Hi Achim, 2014ko irailak 8an, Achim Gratz-ek idatzi zuen: >=20 > Aaron Ecay writes: >> Eric Schulte has said >> that the deprecation of this feature is =E2=80=9Cpremature=E2=80=9D. I = didn=E2=80=99t realize >> at the time that the deprecation was also included in the manual rather >> than just a code comment. Possibly it should be un-deprecated. >=20 > It shouldn't, owing to a number of essentially un-fixable corner cases > and its inherent non-scaleability. Can you say more about the corner cases? I looked for discussion on the mailing list around the time your changes were introduced. I only found a message (in a thread about how/where #+call lines insert their results) that treats the change as a fait accompli, (=E2=80=9CI agree that this didn't make all = that much sense in the past, but with property evaluation and elisp argument evaluation now anchored to the point of call [...]=E2=80=9D) I could have missed something, of course. As to the non-scalability, that should be fixed by some combination of the parser cache and retrieving all properties at once (via =E2=80=98org-entry-properties=E2=80=99) rather than =E2=80=98org-entry-get= =E2=80=99-ing them one-by-one. There are a couple recent threads about this. Here=E2=80=99s one about a reimplementation of the property API functions in terms of the parser. Here the speed tradeoffs of the two approaches are discussed. (IOW, as presently implemented the classical method is not scalable, but said unscalability is by no means =E2=80=9Cinherent=E2=80=9D.) >=20 >> Certainly I agree that the suggested replacement is less capable. >=20 > Do you have an example of something that it cannot do (modulo the bugs > and corners of the deprecated syntax)? See the attached file for two examples, one related to #+call lines and one not. Again, can you say more about what you mean by the bugs and corners of the deprecated syntax? The #+call behavior doesn=E2=80=99t seem like a bug= , but basically a difference in whether header args are dynamically (wrt point of call) or lexically (wrt point of definition) scoped. Dynamic vs. lexical scoping is not a bug, but a matter of taste/language design/etc. Most computer languages with which I=E2=80=99m familiar (Pytho= n, R, C, Scheme/Lisp, ...) use lexical scoping by default, and elisp has been slowly but steadily moving in that direction for years. Thus this new suggested dynamic-type behavior for header args is surprising to me. The first demonstration in the attachment (not related to #+calls) seems like a much clearer case of deficiency of the new system: an inability to inherit different args from different levels. (Please factor away from the nonsense strings in place of =E2=80=9Cyes=E2=80=9D and= =E2=80=9Cno=E2=80=9D =E2=80=93 I wanted to make it clear where each value was coming from, and assure that they were not being generated by default. Of course in a real use case the values for these header args would be =E2=80=9Cyes=E2=80=9D and = =E2=80=9Cno=E2=80=9D. Also, one could also demonstrate the problem with header args that can take an arbitrary string value by design, like :session.) >From your other mail: 2014ko irailak 8an, Achim Gratz-ek idatzi zuen: >=20 > Rainer M Krug writes: >> Aaron Ecay writes: [...] >>> Are you aware that you can set individual header args as properties? >>> Something like (at the file level): >=20 > Are you aware that this doesn't quite do what you think it does, some of > the time, when things become more complex than your example? Again, can you say more about what you mean here? As a personal anecdote, I have never been surprised by the behavior of =E2=80=9Cclassic= =E2=80=9D header arg properties. >=20 >> I was using this deprecated behavior and I was *very* happy with it, but >> I am trying to adjust to the new syntax. >>=20 >> So how can I use the new syntax? >=20 > If you maybe had an example of what you're trying to do instead of > asking stuff about things you don't want to do? Otherwise, have a look > at >=20 > /testing/examples/ob-header-arg-defaults.org I find the content of this file incredibly dense, and the suggestion of its use as documentation bordering on a joke. (Documentation may not exist, and that just means an area for improvement has been found. But it=E2=80=99s not as though we=E2=80=99re all going to read that file an= d suddenly understand what you mean.) It looks like it is trying to demonstrate inheritance and overriding of :var header args. I can=E2=80=99t figure out why the #+call in =E2=80=9COverwrite=E2=80=9D gets go1, but the addition of= =E2=80=9Cvar+ to1=E2=80=9D in =E2=80=9CAccumulate=E2=80=9D causes this to shift, not to =E2=80=9Cto1= =E2=80=9D, but to =E2=80=9Cge1=E2=80=9D. That is a very confusing interaction (to name just one). It=E2=80=99s also= not clear to me how it relates to other header args, since vars supplement each other, whereas other types of header replace. --=20 Aaron Ecay --=-=-= Content-Type: text/x-org; charset=utf-8 Content-Disposition: inline; filename=foo5.org Content-Transfer-Encoding: quoted-printable * Prelim Run this code first: #+begin_src emacs-lisp (require 'cl-lib) (defun awe-show-headers (&rest headers) (pp-to-string (save-excursion (goto-char org-babel-current-src-block-location) (cl-delete-if-not (lambda (pair) (memq (car pair) headers)) (nth 2 (org-babel-get-src-block-info 'light)))))) #+end_src #+RESULTS: : awe-show-headers * Case 1 ** The old way :PROPERTIES: :cache: foo :comments: bar :END: #+begin_src emacs-lisp (awe-show-headers :cache :comments) #+end_src #+RESULTS: : ((:comments . "bar yes") : (:cache . "foo no")) *** Subtree :PROPERTIES: :cache: quux :END: *Good*: we can inherit different header args from multiple levels in the hi= erarchy. #+begin_src emacs-lisp (awe-show-headers :cache :comments) #+end_src #+RESULTS: : ((:comments . "bar yes") : (:cache . "quux no")) ** The new way :PROPERTIES: :header-args: :cache foo :comments bar :END: #+begin_src emacs-lisp (awe-show-headers :cache :comments) #+end_src #+RESULTS: : ((:comments . "bar yes") : (:cache . "foo no")) *** Subtree :PROPERTIES: :header-args: :cache quux :END: *PROBLEM*: we don=E2=80=99t get =3D:comments foo=3D from parent headline (= =E2=80=9CThe new way=E2=80=9D) #+begin_src emacs-lisp (awe-show-headers :cache :comments) #+end_src #+RESULTS: : ((:comments . "yes") : (:cache . "quux no")) *** Subtree 2 :PROPERTIES: :header-args+: :cache quux :END: *PROBLEM*: we still don=E2=80=99t get =3D:comments foo=3D from parent headl= ine even by using the + #+begin_src emacs-lisp (awe-show-headers :cache :comments) #+end_src #+RESULTS: : ((:comments . "yes") : (:cache . "quux no")) * Case 2 ** old way *** subtree :PROPERTIES: :var: awe-x=3D1 :END: #+name: call-me #+begin_src emacs-lisp (or (and (boundp 'awe-x) awe-x) "drat") #+end_src *** other subtree *Good*: the variable is bound from the site of definition, not call. #+call: call-me() #+RESULTS: : 1 ** new way *** subtree :PROPERTIES: :header-args: :var awe-x=3D1 :END: #+name: call-me-new #+begin_src emacs-lisp (or (and (boundp 'awe-x) awe-x) "drat") #+end_src *** other subtree *Bad*: the variable doesn=E2=80=99t get bound #+call: call-me-new() #+RESULTS: : drat --=-=-=--