[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [O] [RFC] Standardized code block keywords
From: |
Sebastien Vauban |
Subject: |
Re: [O] [RFC] Standardized code block keywords |
Date: |
Fri, 21 Oct 2011 10:17:56 +0200 |
User-agent: |
Gnus/5.110018 (No Gnus v0.18) Emacs/23.3 (windows-nt) |
Hi Nick, Tom, Eric and all,
Nick Dokos wrote:
> Thomas S. Dye <address@hidden> wrote:
>> Eric Schulte <address@hidden> writes:
>>
>>>> [1] I have the same "annoying" feelings with #+SOURCE, #+SRCNAME,
>>>> #+FUNCTION,
>>>> #+CALL, #+LOB, and SBE, some of which are interchangeable; some
>>>> not. I'd prefer deprecating an old form when a better one is found.
>>>
>>> This point of view has been raised previously both on the mailing list
>>> and in the #org-mode IRC chat room. I think it is time that we decided as
>>> a community what we want to do about the prevalence of code block
>>> synonyms -- we should make this decision before the release of Emacs24
>>> after which syntax will become harder to change.
Thanks for tackling this.
>>> There are currently a number of instances of synonymous keywords when
>>> dealing with code blocks, specifically.
>>>
>>> named code blocks [1] -- "source" "srcname" "function"
>>> calling external functions [2] -- "call" "lob"
>>> named data [3] -- "tblname" "resname" "results" "data"
>>>
>>> Ideally if we limit each of the above to only one alternative we could
>>> simplify the specification of code blocks in Org-mode making them easier
>>> to learn and use and removing some of the mystery around their syntax.
>>>
>>> What does everyone think?
>>>
>>> Are there suggestions for the best names for each code block entity
>>> (either in the list or not in the list)?
>>>
>>> Are there cases where we want to continue to allow synonyms (e.g., in
>>> named data so that "results" can be used for code block results but
>>> "data" can be used for hand-written data)?
>>>
>>> Thanks -- Eric
>>>
>>> Footnotes:
>>> [1] named code blocks
>>>
>>> #+source: foo
>>> #+begin_src emacs-lisp
>>> 'foo
>>> #+end_src
>>>
>>> #+srcname: foo
>>> #+begin_src emacs-lisp
>>> 'foo
>>> #+end_src
>>>
>>> #+function: foo
>>> #+begin_src emacs-lisp
>>> 'foo
>>> #+end_src
>>>
>>> [2] calling external functions
>>>
>>> #+call: foo()
>>>
>>> #+lob: foo()
>>>
>>> [3] named data
>>>
>>> #+data: something
>>> : something
>>> #+results: something
>>> : something
>>>
>>> etc...
>>
>> named code blocks [1] "source"
>> calling external functions [2] "call"
>> named data [3] "object"
>>
>> My motivation for [3] "object" instead of the suggested alternates is the
>> hope that it will be possible to name things like lists and paragraphs
>> (that aren't results or data) and pass these objects to source code blocks.
>
> I disagree with Tom on [1]: it should clearly be "srcname", in analogy
> to #+tblname - and also so I don't have to change my files :-} (but see my
> question about tblname below).
I have low attraction for "function" as this seems too-programming oriented:
IMHO, it's too much minded toward the "results value" aspect of Babel
("functional mode"), and not at all toward the "scripting mode" (shell
scripts, SQL commands).
Moreover, in fact, in such blocks, we don't have executable code per se: just
think at Ledger transactions that I would want to wrap...
#+srcname: journal
#+begin_src ledger
2008/01/03 * ( ) ME
Assets:Bank:Checking:799997045030 550.00
EUR
Assets:Bank:Transferred
2008/01/01 * ( ) UNKNOWN-PAYEE
Assets:Bank:Checking:799997045030 21.91
EUR
Expenses:Unknown
#+end_src
..., and reuse in a block later (through the Noweb expansion):
#+srcname: ledger-balance
#+begin_src ledger :cmdline bal :noweb yes
<<journal>>
#+end_src
Though, in this latter case, one could object I could maybe (?) refer them
through the "object" name facility -- I'm referring to point 3 of Tom's
answer, see below.
Note -- Then, I would loose the language-editing facility. When we create
an "object" ("results" or "data"), there is no "language" associated,
hence no ability to edit easily via C-c ', and no correct "native
fontification". In fact, such an object has no delimiter either, so it
would never be a true replacement.
Now, between "srcname" and "source": I'm used to whatever my Yasnippet is
entering for me. That's currently "srcname". I don't have a strong opinion,
though, to choose one over the other, except that I like Nick's argument with
the table analogy.
> I agree on [2] "call".
I clearly agree on "call" as well.
Here, I'd like to ask: what about "sbe"? In my own understanding, it's a
call, absolutely similar to "call". Is there a technical reason to be forced
to differentiate both? If no, can we use "call" as well instead of "sbe"?
> I'm confused by [3] so I will say nothing for now, except to ask some
> questions: are we talking about what a human would use to label a piece of
> data for consumption by a block (including perhaps the future possibilities
> of lists and paragraphs that Tom brought up)? what babel would use to label
> a results block (possibly so that it could be consumed by another block in a
> chain)? both? would that mean that #+tblname would go the way of the dodo
> and that tables would be labelled with #+data (or #+object or whatever else
> we come up with)?
For point 3, Eric, I guess that whichever term is chosen, that does not mean
that "results" will change (I mean: when it's a result of a block execution)?
In other words, if we choose for "object", we still will have the possibility
to use "results" (automatically generated) and "object" to refer to something
we want to use in another call?
>>> named data [3] -- "tblname" "resname" "results" "data"
I don't specifically like "resname".
I would keep "results" for automatically generated "results".
I do like "data", but can learn to like "object" as a more generic term,
future-proof for coming extensions.
Last remark: we could get one step further and wonder if it wouldn't be good
to impose a single way to pass variables? We currently have two different
mechanisms:
#+srcname: convert-date-to-French-format
#+begin_src sql :var column=""
CONVERT(varchar(10), $column, 103) AS $column
#+end_src
and
#+srcname: convert-date-to-French-format(column="")
#+begin_src sql
CONVERT(varchar(10), $column, 103) AS $column
#+end_src
I guess that the first one is easier if we want to construct complex variable
values (which call Emacs Lisp code or such), but...
Thanks for your comments...
Best regards,
Seb
--
Sebastien Vauban
- Re: [O] [ANN] BREAKING CHANGE -- removing #+BABEL file-wide property lines, (continued)
- Re: [O] [ANN] BREAKING CHANGE -- removing #+BABEL file-wide property lines, Sebastien Vauban, 2011/10/20
- [O] [RFC] Standardized code block keywords, Eric Schulte, 2011/10/20
- Re: [O] [RFC] Standardized code block keywords, Thomas S. Dye, 2011/10/20
- Re: [O] [RFC] Standardized code block keywords, Nick Dokos, 2011/10/20
- Re: [O] [RFC] Standardized code block keywords, Christian Moe, 2011/10/21
- Re: [O] [RFC] Standardized code block keywords, Eric Schulte, 2011/10/21
- Re: [O] [RFC] Standardized code block keywords, Thomas S. Dye, 2011/10/21
- Re: [O] [RFC] Standardized code block keywords, Daniel Bausch, 2011/10/23
- Re: [O] [RFC] Standardized code block keywords, Thomas S. Dye, 2011/10/23
- Re: [O] [RFC] Standardized code block keywords, Daniel Bausch, 2011/10/24
- Re: [O] [RFC] Standardized code block keywords,
Sebastien Vauban <=
- Re: [O] [RFC] Standardized code block keywords, Eric Schulte, 2011/10/21
- Re: [O] [RFC] Standardized code block keywords, Sebastien Vauban, 2011/10/21
- Message not available
- Re: [O] [RFC] Standardized code block keywords, Rainer M Krug, 2011/10/25
- Re: [O] [RFC] Standardized code block keywords, Eric Schulte, 2011/10/21
- Re: [O] [RFC] Standardized code block keywords, Eric Schulte, 2011/10/21
- Re: [O] [RFC] Standardized code block keywords, Thomas S. Dye, 2011/10/21
- Re: [O] [RFC] Standardized code block keywords, Eric Schulte, 2011/10/22
- Re: [O] [RFC] Standardized code block keywords, Torsten Wagner, 2011/10/21
- Re: [O] [RFC] Standardized code block keywords, Sebastien Vauban, 2011/10/21
- Re: [O] [RFC] Standardized code block keywords, Eric Schulte, 2011/10/21