emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Org-mode as a metalanguage: calling SQL "functions"
@ 2013-04-01 19:28 Gary Oberbrunner
  2013-04-01 20:41 ` Mike Gauland
  2013-04-02  1:19 ` Eric Abrahamsen
  0 siblings, 2 replies; 17+ messages in thread
From: Gary Oberbrunner @ 2013-04-01 19:28 UTC (permalink / raw)
  To: Orgmode Mailing List

[-- Attachment #1: Type: text/plain, Size: 1065 bytes --]

It seems like you can define "procedures" in org-mode and call them from
elsewhere, with args.
But I'm not sure how well-defined that process is; the documentation is not
completely perfect yet I think.  Here's one thing I'm trying that seems not
to work.

I define a "procedure" as a named ref called recorddate with two args, ver
and order.  The idea is I could later call that with different values of
those args.

#+NAME: recorddate(order="desc")
#+BEGIN_SRC sql :exports none :colnames no :results scalar
select Event.CreatedAt from Event join MachineInfo as MI on
Event.MachineInfoId=MI.Id
 where Event.CreatedAt is not NULL order by CreatedAt $order limit 1;
#+END_SRC sql

(BTW, I really like how $ vars are substituted into SQL.  Nice.)  But when
I try to call it like this:

 * earliest record is call_recorddate(ver="'.'", order="asc")
or like this:
 #+CALL: recorddate(ver="'.'", order="asc")

and I try to export as LaTeX (or anything), I get
 org-babel-ref-resolve: Reference 'recorddate' not found in this buffer

Is this supposed to work?

-- 
Gary

[-- Attachment #2: Type: text/html, Size: 1566 bytes --]

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: Org-mode as a metalanguage: calling SQL "functions"
  2013-04-01 19:28 Org-mode as a metalanguage: calling SQL "functions" Gary Oberbrunner
@ 2013-04-01 20:41 ` Mike Gauland
  2013-04-02  1:19 ` Eric Abrahamsen
  1 sibling, 0 replies; 17+ messages in thread
From: Mike Gauland @ 2013-04-01 20:41 UTC (permalink / raw)
  To: emacs-orgmode

Gary Oberbrunner <garyo <at> oberbrunner.com> writes:
> Is this supposed to work?
> -- Gary

I'm not sure how it's /supposed/ to work, either, but this example works for a
sqlite database I've been playing with:

  #+NAME: artist
  #+BEGIN_SRC sqlite :db the_sound_A-Z.sql :var song_title=""
  select artist from playlist where title=="$song_title";
  #+END_SRC

  #+CALL: artist(song_title="Pressure")

  #+RESULTS: artist(song_title="Pressure")
  : Billy Joel

Note the need for double quotes around $song_title in the SRC block.

I'm using the latest from git, and emacs 23.2.1 on Debian.

Hope that helps.

Kind Regards,
Mike Gauland

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: Org-mode as a metalanguage: calling SQL "functions"
  2013-04-01 19:28 Org-mode as a metalanguage: calling SQL "functions" Gary Oberbrunner
  2013-04-01 20:41 ` Mike Gauland
@ 2013-04-02  1:19 ` Eric Abrahamsen
  2013-04-02  1:45   ` Eric Schulte
  1 sibling, 1 reply; 17+ messages in thread
From: Eric Abrahamsen @ 2013-04-02  1:19 UTC (permalink / raw)
  To: emacs-orgmode

Gary Oberbrunner <garyo@oberbrunner.com> writes:

> It seems like you can define "procedures" in org-mode and call them
> from elsewhere, with args.
> But I'm not sure how well-defined that process is; the documentation
> is not completely perfect yet I think. Here's one thing I'm trying
> that seems not to work.
>
> I define a "procedure" as a named ref called recorddate with two args,
> ver and order. The idea is I could later call that with different
> values of those args.
>
> #+NAME: recorddate(order="desc")
> #+BEGIN_SRC sql :exports none :colnames no :results scalar
> select Event.CreatedAt from Event join MachineInfo as MI on
> Event.MachineInfoId=MI.Id
> where Event.CreatedAt is not NULL order by CreatedAt $order limit 1;
> #+END_SRC sql
>
> (BTW, I really like how $ vars are substituted into SQL. Nice.) But
> when I try to call it like this:
>
> * earliest record is call_recorddate(ver="'.'", order="asc")
> or like this:
> #+CALL: recorddate(ver="'.'", order="asc")
>
> and I try to export as LaTeX (or anything), I get 
> org-babel-ref-resolve: Reference 'recorddate' not found in this buffer
>
> Is this supposed to work?

You're supposed to "load" named blocks before you can call them with
#+CALL, etc. I'm a little surprised that it doesn't automatically find
blocks defined in the same buffer, but calling C-c C-v i (ie
org-babel-lob-ingest) and loading the present file should make
"recorddate" available for calling.

E

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: Org-mode as a metalanguage: calling SQL "functions"
  2013-04-02  1:19 ` Eric Abrahamsen
@ 2013-04-02  1:45   ` Eric Schulte
  2013-04-02  2:46     ` Eric Abrahamsen
  2013-04-02  2:54     ` Gary Oberbrunner
  0 siblings, 2 replies; 17+ messages in thread
From: Eric Schulte @ 2013-04-02  1:45 UTC (permalink / raw)
  To: Eric Abrahamsen; +Cc: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 1871 bytes --]

Eric Abrahamsen <eric@ericabrahamsen.net> writes:

> Gary Oberbrunner <garyo@oberbrunner.com> writes:
>
>> It seems like you can define "procedures" in org-mode and call them
>> from elsewhere, with args.
>> But I'm not sure how well-defined that process is; the documentation
>> is not completely perfect yet I think. Here's one thing I'm trying
>> that seems not to work.
>>
>> I define a "procedure" as a named ref called recorddate with two args,
>> ver and order. The idea is I could later call that with different
>> values of those args.
>>
>> #+NAME: recorddate(order="desc")
>> #+BEGIN_SRC sql :exports none :colnames no :results scalar
>> select Event.CreatedAt from Event join MachineInfo as MI on
>> Event.MachineInfoId=MI.Id
>> where Event.CreatedAt is not NULL order by CreatedAt $order limit 1;
>> #+END_SRC sql
>>
>> (BTW, I really like how $ vars are substituted into SQL. Nice.) But
>> when I try to call it like this:
>>
>> * earliest record is call_recorddate(ver="'.'", order="asc")
>> or like this:
>> #+CALL: recorddate(ver="'.'", order="asc")
>>
>> and I try to export as LaTeX (or anything), I get 
>> org-babel-ref-resolve: Reference 'recorddate' not found in this buffer
>>
>> Is this supposed to work?
>

Yes, your example should work.  From the "Evaluating code blocks"
section of the Org-mode manual.

,----
|    It is also possible to evaluate named code blocks from anywhere in an
| Org mode buffer or an Org mode table.  Live code blocks located in the
| current Org mode buffer or in the "Library of Babel" (see *note Library
| of Babel::) can be executed.  Named code blocks can be executed with a
| separate '#+CALL:' line or inline within a block of text.
`----

There is no need to load code blocks in the same buffer into the library
of babel.

This example works for me evaluating code blocks in the same buffer
using call lines.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: in-buffer-execution-example.org --]
[-- Type: text/x-org, Size: 364 bytes --]

#+Title: Call Example

#+name: example-block
#+begin_src sh :var input=""
  echo "input is $input"
#+end_src

Here's a simple call using a named argument.
#+call: example-block(input="foo")

#+RESULTS: example-block(input="foo")
: input is foo

It also works with a positional argument.
#+call: example-block("bar")

#+RESULTS: example-block("bar")
: input is bar

[-- Attachment #3: Type: text/plain, Size: 56 bytes --]


When I export this to e.g., html I get the following.


[-- Attachment #4: example.html --]
[-- Type: text/html, Size: 4008 bytes --]

[-- Attachment #5: Type: text/plain, Size: 214 bytes --]


The call lines are replaced with their results as part of the export
process.

If the above doesn't work for you, then I imagine something is wrong
with your install.

-- 
Eric Schulte
http://cs.unm.edu/~eschulte

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: Org-mode as a metalanguage: calling SQL "functions"
  2013-04-02  1:45   ` Eric Schulte
@ 2013-04-02  2:46     ` Eric Abrahamsen
  2013-04-02  2:54     ` Gary Oberbrunner
  1 sibling, 0 replies; 17+ messages in thread
From: Eric Abrahamsen @ 2013-04-02  2:46 UTC (permalink / raw)
  To: emacs-orgmode

Eric Schulte <schulte.eric@gmail.com> writes:

> Eric Abrahamsen <eric@ericabrahamsen.net> writes:
>
>> Gary Oberbrunner <garyo@oberbrunner.com> writes:
>>
>>> It seems like you can define "procedures" in org-mode and call them
>>> from elsewhere, with args.
>>> But I'm not sure how well-defined that process is; the documentation
>>> is not completely perfect yet I think. Here's one thing I'm trying
>>> that seems not to work.
>>>
>>> I define a "procedure" as a named ref called recorddate with two args,
>>> ver and order. The idea is I could later call that with different
>>> values of those args.
>>>
>>> #+NAME: recorddate(order="desc")
>>> #+BEGIN_SRC sql :exports none :colnames no :results scalar
>>> select Event.CreatedAt from Event join MachineInfo as MI on
>>> Event.MachineInfoId=MI.Id
>>> where Event.CreatedAt is not NULL order by CreatedAt $order limit 1;
>>> #+END_SRC sql
>>>
>>> (BTW, I really like how $ vars are substituted into SQL. Nice.) But
>>> when I try to call it like this:
>>>
>>> * earliest record is call_recorddate(ver="'.'", order="asc")
>>> or like this:
>>> #+CALL: recorddate(ver="'.'", order="asc")
>>>
>>> and I try to export as LaTeX (or anything), I get 
>>> org-babel-ref-resolve: Reference 'recorddate' not found in this buffer
>>>
>>> Is this supposed to work?
>>
>
> Yes, your example should work.  From the "Evaluating code blocks"
> section of the Org-mode manual.
>
> ,----
> |    It is also possible to evaluate named code blocks from anywhere in an
> | Org mode buffer or an Org mode table.  Live code blocks located in the
> | current Org mode buffer or in the "Library of Babel" (see *note Library
> | of Babel::) can be executed.  Named code blocks can be executed with a
> | separate '#+CALL:' line or inline within a block of text.
> `----
>
> There is no need to load code blocks in the same buffer into the library
> of babel.

I think what he (and I, when I tried his version) ran into is that
without a ":var" attribute on the named code block, you get
the "not found" error.

Ie, simply declaring #+name: recorddate(order="desc") isn't enough to
let the block know to expect the var.

Presumably that *should* be an error, as the variable should be declared
before being used, but the actual error message is a little misleading.

Eric

> This example works for me evaluating code blocks in the same buffer
> using call lines.
>
> #+Title: Call Example
>
> #+name: example-block
> #+begin_src sh :var input=""
>   echo "input is $input"
> #+end_src
>
> Here's a simple call using a named argument.
> #+call: example-block(input="foo")
>
> #+RESULTS: example-block(input="foo")
> : input is foo
>
> It also works with a positional argument.
> #+call: example-block("bar")
>
> #+RESULTS: example-block("bar")
> : input is bar
>
> When I export this to e.g., html I get the following.
>
> Call Example
>
> Call Example
>
> echo "input is $input"
>
> Here's a simple call using a named argument. 
>
>
> input is foo
>
> It also works with a positional argument. 
>
>
> input is bar
>
> Date: 2013-04-01T19:39-0600
>
> Author: 
>
> Org version 7.9.3f with Emacs version 24
>
> Validate XHTML 1.0 
>
>
> The call lines are replaced with their results as part of the export
> process.
>
> If the above doesn't work for you, then I imagine something is wrong
> with your install.

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: Org-mode as a metalanguage: calling SQL "functions"
  2013-04-02  1:45   ` Eric Schulte
  2013-04-02  2:46     ` Eric Abrahamsen
@ 2013-04-02  2:54     ` Gary Oberbrunner
  2013-04-02 21:54       ` Eric Schulte
  1 sibling, 1 reply; 17+ messages in thread
From: Gary Oberbrunner @ 2013-04-02  2:54 UTC (permalink / raw)
  To: Eric Schulte; +Cc: Eric Abrahamsen, Orgmode Mailing List

[-- Attachment #1: Type: text/plain, Size: 3194 bytes --]

Aha -- you have to use the :var syntax on the begin_src line, not the
params-in-parens syntax on the name line.  Your version works:

#+name: example-block
#+begin_src sh :var input=""
  echo "input is $input"
#+end_src

but this doesn't:

#+name: example-block(input="")
#+begin_src sh
  echo "input is $input"
#+end_src

The doc seems to say it should work the same, in
http://orgmode.org/manual/var.html (see "Alternate Argument Syntax").



On Mon, Apr 1, 2013 at 9:45 PM, Eric Schulte <schulte.eric@gmail.com> wrote:

> Eric Abrahamsen <eric@ericabrahamsen.net> writes:
>
> > Gary Oberbrunner <garyo@oberbrunner.com> writes:
> >
> >> It seems like you can define "procedures" in org-mode and call them
> >> from elsewhere, with args.
> >> But I'm not sure how well-defined that process is; the documentation
> >> is not completely perfect yet I think. Here's one thing I'm trying
> >> that seems not to work.
> >>
> >> I define a "procedure" as a named ref called recorddate with two args,
> >> ver and order. The idea is I could later call that with different
> >> values of those args.
> >>
> >> #+NAME: recorddate(order="desc")
> >> #+BEGIN_SRC sql :exports none :colnames no :results scalar
> >> select Event.CreatedAt from Event join MachineInfo as MI on
> >> Event.MachineInfoId=MI.Id
> >> where Event.CreatedAt is not NULL order by CreatedAt $order limit 1;
> >> #+END_SRC sql
> >>
> >> (BTW, I really like how $ vars are substituted into SQL. Nice.) But
> >> when I try to call it like this:
> >>
> >> * earliest record is call_recorddate(ver="'.'", order="asc")
> >> or like this:
> >> #+CALL: recorddate(ver="'.'", order="asc")
> >>
> >> and I try to export as LaTeX (or anything), I get
> >> org-babel-ref-resolve: Reference 'recorddate' not found in this buffer
> >>
> >> Is this supposed to work?
> >
>
> Yes, your example should work.  From the "Evaluating code blocks"
> section of the Org-mode manual.
>
> ,----
> |    It is also possible to evaluate named code blocks from anywhere in an
> | Org mode buffer or an Org mode table.  Live code blocks located in the
> | current Org mode buffer or in the "Library of Babel" (see *note Library
> | of Babel::) can be executed.  Named code blocks can be executed with a
> | separate '#+CALL:' line or inline within a block of text.
> `----
>
> There is no need to load code blocks in the same buffer into the library
> of babel.
>
> This example works for me evaluating code blocks in the same buffer
> using call lines.
>
>
>
> When I export this to e.g., html I get the following.
>
>
> ** **
>   Call Example
>
> echo "input is $input"
>
>  Here's a simple call using a named argument.
>
> input is foo
>
>  It also works with a positional argument.
>
> input is bar
>
>  Date: 2013-04-01T19:39-0600
>
> Author:
>
> Org <http://orgmode.org> version 7.9.3f with Emacs<http://www.gnu.org/software/emacs/>version 24
> Validate XHTML 1.0 <http://validator.w3.org/check?uri=referer>
>
>
> The call lines are replaced with their results as part of the export
> process.
>
> If the above doesn't work for you, then I imagine something is wrong
> with your install.
>
> --
> Eric Schulte
> http://cs.unm.edu/~eschulte
>
>


-- 
Gary

[-- Attachment #2: Type: text/html, Size: 4931 bytes --]

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: Org-mode as a metalanguage: calling SQL "functions"
  2013-04-02  2:54     ` Gary Oberbrunner
@ 2013-04-02 21:54       ` Eric Schulte
  2013-04-03  5:50         ` Andreas Röhler
  2013-04-03  5:54         ` Carsten Dominik
  0 siblings, 2 replies; 17+ messages in thread
From: Eric Schulte @ 2013-04-02 21:54 UTC (permalink / raw)
  To: Gary Oberbrunner; +Cc: Eric Abrahamsen, Orgmode Mailing List

Gary Oberbrunner <garyo@oberbrunner.com> writes:

> Aha -- you have to use the :var syntax on the begin_src line, not the
> params-in-parens syntax on the name line.  Your version works:
>
> #+name: example-block
> #+begin_src sh :var input=""
>   echo "input is $input"
> #+end_src
>
> but this doesn't:
>
> #+name: example-block(input="")
> #+begin_src sh
>   echo "input is $input"
> #+end_src
>
> The doc seems to say it should work the same, in
> http://orgmode.org/manual/var.html (see "Alternate Argument Syntax").
>

At this point I'm not sure if the documentation or the code should be
amended.  I've personally never liked the args-in-block-name syntax, but
I don't recall if we formally decided to abandon it, or if it has simply
been broken in a recent commit.

-- 
Eric Schulte
http://cs.unm.edu/~eschulte

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: Org-mode as a metalanguage: calling SQL "functions"
  2013-04-02 21:54       ` Eric Schulte
@ 2013-04-03  5:50         ` Andreas Röhler
  2013-04-03  5:54         ` Carsten Dominik
  1 sibling, 0 replies; 17+ messages in thread
From: Andreas Röhler @ 2013-04-03  5:50 UTC (permalink / raw)
  To: emacs-orgmode

Am 02.04.2013 23:54, schrieb Eric Schulte:
> Gary Oberbrunner <garyo@oberbrunner.com> writes:
>
>> Aha -- you have to use the :var syntax on the begin_src line, not the
>> params-in-parens syntax on the name line.  Your version works:
>>
>> #+name: example-block
>> #+begin_src sh :var input=""
>>    echo "input is $input"
>> #+end_src
>>
>> but this doesn't:
>>
>> #+name: example-block(input="")
>> #+begin_src sh
>>    echo "input is $input"
>> #+end_src
>>
>> The doc seems to say it should work the same, in
>> http://orgmode.org/manual/var.html (see "Alternate Argument Syntax").
>>
>
> At this point I'm not sure if the documentation or the code should be
> amended.  I've personally never liked the args-in-block-name syntax, but
> I don't recall if we formally decided to abandon it, or if it has simply
> been broken in a recent commit.
>

Hi Eric,

AFAIU exist considerable backsides when allowing this args-in-block-name.

As languages differ, you must write some translations for every lang somehow, i.e, re-invent it's
handling.

Also can't see a meta-languags than, it would mean address other languages from an Org dialect.

A major backside already visible it breaking the legibility of native languages code.
Org constructs are not easier to read than native lang, it's more difficult with that lined-up args lists.

Andreas

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: Org-mode as a metalanguage: calling SQL "functions"
  2013-04-02 21:54       ` Eric Schulte
  2013-04-03  5:50         ` Andreas Röhler
@ 2013-04-03  5:54         ` Carsten Dominik
  2013-04-03 13:09           ` Eric Schulte
  1 sibling, 1 reply; 17+ messages in thread
From: Carsten Dominik @ 2013-04-03  5:54 UTC (permalink / raw)
  To: Eric Schulte; +Cc: Eric Abrahamsen, Orgmode Mailing List, Gary Oberbrunner


On 2.4.2013, at 23:54, Eric Schulte <schulte.eric@gmail.com> wrote:

> Gary Oberbrunner <garyo@oberbrunner.com> writes:
> 
>> Aha -- you have to use the :var syntax on the begin_src line, not the
>> params-in-parens syntax on the name line.  Your version works:
>> 
>> #+name: example-block
>> #+begin_src sh :var input=""
>>  echo "input is $input"
>> #+end_src
>> 
>> but this doesn't:
>> 
>> #+name: example-block(input="")
>> #+begin_src sh
>>  echo "input is $input"
>> #+end_src
>> 
>> The doc seems to say it should work the same, in
>> http://orgmode.org/manual/var.html (see "Alternate Argument Syntax").
>> 
> 
> At this point I'm not sure if the documentation or the code should be
> amended.  I've personally never liked the args-in-block-name syntax, but
> I don't recall if we formally decided to abandon it, or if it has simply
> been broken in a recent commit.

I am not sure if I have any say here, but I agree that the args in name notation looks not as good and might be considered for abolishment.

- Carsten

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: Org-mode as a metalanguage: calling SQL "functions"
  2013-04-03  5:54         ` Carsten Dominik
@ 2013-04-03 13:09           ` Eric Schulte
  2013-04-04 12:26             ` Sebastien Vauban
  0 siblings, 1 reply; 17+ messages in thread
From: Eric Schulte @ 2013-04-03 13:09 UTC (permalink / raw)
  To: Carsten Dominik; +Cc: Eric Abrahamsen, Orgmode Mailing List, Gary Oberbrunner

Carsten Dominik <carsten.dominik@gmail.com> writes:

> On 2.4.2013, at 23:54, Eric Schulte <schulte.eric@gmail.com> wrote:
>
>> Gary Oberbrunner <garyo@oberbrunner.com> writes:
>> 
>>> Aha -- you have to use the :var syntax on the begin_src line, not the
>>> params-in-parens syntax on the name line.  Your version works:
>>> 
>>> #+name: example-block
>>> #+begin_src sh :var input=""
>>>  echo "input is $input"
>>> #+end_src
>>> 
>>> but this doesn't:
>>> 
>>> #+name: example-block(input="")
>>> #+begin_src sh
>>>  echo "input is $input"
>>> #+end_src
>>> 
>>> The doc seems to say it should work the same, in
>>> http://orgmode.org/manual/var.html (see "Alternate Argument Syntax").
>>> 
>> 
>> At this point I'm not sure if the documentation or the code should be
>> amended.  I've personally never liked the args-in-block-name syntax, but
>> I don't recall if we formally decided to abandon it, or if it has simply
>> been broken in a recent commit.
>
> I am not sure if I have any say here, but I agree that the args in
> name notation looks not as good and might be considered for
> abolishment.
>

Great, I agree wholeheartedly and I'll update the documentation
accordingly (and take a look at lob-ingest to ensure it no longer uses
this var-in-name style).

Cheers,

>
> - Carsten

-- 
Eric Schulte
http://cs.unm.edu/~eschulte

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: Org-mode as a metalanguage: calling SQL "functions"
  2013-04-03 13:09           ` Eric Schulte
@ 2013-04-04 12:26             ` Sebastien Vauban
  2013-04-04 12:49               ` Eric Schulte
  0 siblings, 1 reply; 17+ messages in thread
From: Sebastien Vauban @ 2013-04-04 12:26 UTC (permalink / raw)
  To: emacs-orgmode-mXXj517/zsQ

Hello Eric,

Eric Schulte wrote:
>>> At this point I'm not sure if the documentation or the code should be
>>> amended.  I've personally never liked the args-in-block-name syntax, but
>>> I don't recall if we formally decided to abandon it, or if it has simply
>>> been broken in a recent commit.
>>
>> I am not sure if I have any say here, but I agree that the args in
>> name notation looks not as good and might be considered for
>> abolishment.
>
> Great, I agree wholeheartedly and I'll update the documentation
> accordingly (and take a look at lob-ingest to ensure it no longer uses
> this var-in-name style).

I confirm that, following a discussion we had, you had decided to drop the
alternate syntax, a couple of months ago (more than 2 ;-)).

Best regards,
  Seb

-- 
Sebastien Vauban

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: Org-mode as a metalanguage: calling SQL "functions"
  2013-04-04 12:26             ` Sebastien Vauban
@ 2013-04-04 12:49               ` Eric Schulte
  2013-04-04 20:10                 ` Sebastien Vauban
  0 siblings, 1 reply; 17+ messages in thread
From: Eric Schulte @ 2013-04-04 12:49 UTC (permalink / raw)
  To: Sebastien Vauban; +Cc: emacs-orgmode

"Sebastien Vauban" <wxhgmqzgwmuf@spammotel.com> writes:

> Hello Eric,
>
> Eric Schulte wrote:
>>>> At this point I'm not sure if the documentation or the code should be
>>>> amended.  I've personally never liked the args-in-block-name syntax, but
>>>> I don't recall if we formally decided to abandon it, or if it has simply
>>>> been broken in a recent commit.
>>>
>>> I am not sure if I have any say here, but I agree that the args in
>>> name notation looks not as good and might be considered for
>>> abolishment.
>>
>> Great, I agree wholeheartedly and I'll update the documentation
>> accordingly (and take a look at lob-ingest to ensure it no longer uses
>> this var-in-name style).
>
> I confirm that, following a discussion we had, you had decided to drop the
> alternate syntax, a couple of months ago (more than 2 ;-)).
>
> Best regards,
>   Seb

Great, so I'm not imagining things.  Thanks Seb.

-- 
Eric Schulte
http://cs.unm.edu/~eschulte

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: Org-mode as a metalanguage: calling SQL "functions"
  2013-04-04 12:49               ` Eric Schulte
@ 2013-04-04 20:10                 ` Sebastien Vauban
  2013-04-05 15:43                   ` Gary Oberbrunner
  0 siblings, 1 reply; 17+ messages in thread
From: Sebastien Vauban @ 2013-04-04 20:10 UTC (permalink / raw)
  To: emacs-orgmode-mXXj517/zsQ

Eric,

Eric Schulte wrote:
> "Sebastien Vauban" <wxhgmqzgwmuf-geNee64TY+gS+FvcfC7Uqw@public.gmane.org> writes:
>> Eric Schulte wrote:
>>>>> At this point I'm not sure if the documentation or the code should be
>>>>> amended.  I've personally never liked the args-in-block-name syntax, but
>>>>> I don't recall if we formally decided to abandon it, or if it has simply
>>>>> been broken in a recent commit.
>>>>
>>>> I am not sure if I have any say here, but I agree that the args in
>>>> name notation looks not as good and might be considered for
>>>> abolishment.
>>>
>>> Great, I agree wholeheartedly and I'll update the documentation
>>> accordingly (and take a look at lob-ingest to ensure it no longer uses
>>> this var-in-name style).
>>
>> I confirm that, following a discussion we had, you had decided to drop the
>> alternate syntax, a couple of months ago (more than 2 ;-)).
>
> Great, so I'm not imagining things.  Thanks Seb.

For the sake of clarity, it all began (in September 2011) with the fact it was
more difficult to trap errors such as missing default value, in the
functional-syntax style. See
http://article.gmane.org/gmane.emacs.orgmode/46888.

This also lead, a couple of weeks later (October 2011), to questionning the
multiple keywords used for code blocks, such as #+source: and #+srcname:. See
http://article.gmane.org/gmane.emacs.orgmode/48399.

Best regards,
  Seb

-- 
Sebastien Vauban

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: Org-mode as a metalanguage: calling SQL "functions"
  2013-04-04 20:10                 ` Sebastien Vauban
@ 2013-04-05 15:43                   ` Gary Oberbrunner
  2013-04-05 16:31                     ` Eric Schulte
  0 siblings, 1 reply; 17+ messages in thread
From: Gary Oberbrunner @ 2013-04-05 15:43 UTC (permalink / raw)
  Cc: Orgmode Mailing List

[-- Attachment #1: Type: text/plain, Size: 2634 bytes --]

What I'd really like in the org-mode doc somewhere (or on worg?) is the
babel syntax broken out like a traditional programming language, by which I
mean describe the syntax[es] for *defining* a function in one place
(including all the ways to define args and their default values), and
describe the syntax[es] for *calling* a function in a separate section
(including how to pass args).  If the variable semantics vary by language
(as they do), just say so (e.g. when defining a SQL function, vars are
substituted into the body by prefixing the names with $, but in python they
are local vars in non-session mode and global vars in session mode and so
on.  Maybe this doc section shouldn't try to enumerate all those languages,
but just redirect to the proper worg babel language page for details on arg
handling.

I think all this info is already there in one place or another, but IMHO
it's not organized in such a way that a newbie can start to use org-mode as
a metaprogramming language without lots of false starts and reading the
source (like I did).



On Thu, Apr 4, 2013 at 4:10 PM, Sebastien Vauban <wxhgmqzgwmuf@spammotel.com
> wrote:

> Eric,
>
> Eric Schulte wrote:
> > "Sebastien Vauban" <wxhgmqzgwmuf@spammotel.com> writes:
> >> Eric Schulte wrote:
> >>>>> At this point I'm not sure if the documentation or the code should be
> >>>>> amended.  I've personally never liked the args-in-block-name syntax,
> but
> >>>>> I don't recall if we formally decided to abandon it, or if it has
> simply
> >>>>> been broken in a recent commit.
> >>>>
> >>>> I am not sure if I have any say here, but I agree that the args in
> >>>> name notation looks not as good and might be considered for
> >>>> abolishment.
> >>>
> >>> Great, I agree wholeheartedly and I'll update the documentation
> >>> accordingly (and take a look at lob-ingest to ensure it no longer uses
> >>> this var-in-name style).
> >>
> >> I confirm that, following a discussion we had, you had decided to drop
> the
> >> alternate syntax, a couple of months ago (more than 2 ;-)).
> >
> > Great, so I'm not imagining things.  Thanks Seb.
>
> For the sake of clarity, it all began (in September 2011) with the fact it
> was
> more difficult to trap errors such as missing default value, in the
> functional-syntax style. See
> http://article.gmane.org/gmane.emacs.orgmode/46888.
>
> This also lead, a couple of weeks later (October 2011), to questionning the
> multiple keywords used for code blocks, such as #+source: and #+srcname:.
> See
> http://article.gmane.org/gmane.emacs.orgmode/48399.
>
> Best regards,
>   Seb
>
> --
> Sebastien Vauban
>
>
>


-- 
Gary

[-- Attachment #2: Type: text/html, Size: 3665 bytes --]

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: Org-mode as a metalanguage: calling SQL "functions"
  2013-04-05 15:43                   ` Gary Oberbrunner
@ 2013-04-05 16:31                     ` Eric Schulte
  2013-04-05 17:51                       ` Andreas Röhler
  2013-04-06 20:44                       ` Bastien
  0 siblings, 2 replies; 17+ messages in thread
From: Eric Schulte @ 2013-04-05 16:31 UTC (permalink / raw)
  To: Gary Oberbrunner; +Cc: Orgmode Mailing List

Hi Gary,

I agree.

Gary Oberbrunner <garyo@oberbrunner.com> writes:

> What I'd really like in the org-mode doc somewhere (or on worg?) is the
> babel syntax broken out like a traditional programming language, by which I
> mean describe the syntax[es] for *defining* a function in one place
> (including all the ways to define args and their default values),

I believe this information is currently split between the following two
manual pages.

    (info "(org)Structure of code blocks")
    (info "(org)var")

> and describe the syntax[es] for *calling* a function in a separate
> section (including how to pass args).

This should be fairly completely addressed in the following manual page.

    (info "(org)Evaluating code blocks")

> If the variable semantics vary by language (as they do), just say so
> (e.g. when defining a SQL function, vars are substituted into the body
> by prefixing the names with $, but in python they are local vars in
> non-session mode and global vars in session mode and so on.  Maybe
> this doc section shouldn't try to enumerate all those languages, but
> just redirect to the proper worg babel language page for details on
> arg handling.
>

Yea, this could be a simple note, e.g., "the method by which variables
are applied to code blocks are language-specific and determined by the
semantics of the programming language of the code block, see ...".

>
> I think all this info is already there in one place or another, but IMHO
> it's not organized in such a way that a newbie can start to use org-mode as
> a metaprogramming language without lots of false starts and reading the
> source (like I did).
>

I agree.  I think this information would be best included as a new page
in the manual under the working with source code section.  It could link
to, and be linked from the pages I reference above.

I don't think it'd be overly difficult to write, and shouldn't be more
than a page or two of prose, and as you say it would be very helpful for
beginners.  Alternately this could be a page on Worg, but I think it is
important enough to be included in the manual.

Would you want to take a first pass at such an addition?  If not I can,
but it may be a while before I get to it.

Cheers,

p.s. These two publications could help; a journal article on code blocks
     in Org-mode [1] and a shorter magazine piece on the same [2].  They
     both deal with meta-programming in Org-mode documents.

>
>
>
> On Thu, Apr 4, 2013 at 4:10 PM, Sebastien Vauban <wxhgmqzgwmuf@spammotel.com
>> wrote:
>
>> Eric,
>>
>> Eric Schulte wrote:
>> > "Sebastien Vauban" <wxhgmqzgwmuf@spammotel.com> writes:
>> >> Eric Schulte wrote:
>> >>>>> At this point I'm not sure if the documentation or the code should be
>> >>>>> amended.  I've personally never liked the args-in-block-name syntax,
>> but
>> >>>>> I don't recall if we formally decided to abandon it, or if it has
>> simply
>> >>>>> been broken in a recent commit.
>> >>>>
>> >>>> I am not sure if I have any say here, but I agree that the args in
>> >>>> name notation looks not as good and might be considered for
>> >>>> abolishment.
>> >>>
>> >>> Great, I agree wholeheartedly and I'll update the documentation
>> >>> accordingly (and take a look at lob-ingest to ensure it no longer uses
>> >>> this var-in-name style).
>> >>
>> >> I confirm that, following a discussion we had, you had decided to drop
>> the
>> >> alternate syntax, a couple of months ago (more than 2 ;-)).
>> >
>> > Great, so I'm not imagining things.  Thanks Seb.
>>
>> For the sake of clarity, it all began (in September 2011) with the fact it
>> was
>> more difficult to trap errors such as missing default value, in the
>> functional-syntax style. See
>> http://article.gmane.org/gmane.emacs.orgmode/46888.
>>
>> This also lead, a couple of weeks later (October 2011), to questionning the
>> multiple keywords used for code blocks, such as #+source: and #+srcname:.
>> See
>> http://article.gmane.org/gmane.emacs.orgmode/48399.
>>
>> Best regards,
>>   Seb
>>
>> --
>> Sebastien Vauban
>>
>>
>>


Footnotes: 
[1]  http://www.jstatsoft.org/v46/i03

[2]  http://cs.unm.edu/~eschulte/data/CISE-13-3-SciProg.pdf

-- 
Eric Schulte
http://cs.unm.edu/~eschulte

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: Org-mode as a metalanguage: calling SQL "functions"
  2013-04-05 16:31                     ` Eric Schulte
@ 2013-04-05 17:51                       ` Andreas Röhler
  2013-04-06 20:44                       ` Bastien
  1 sibling, 0 replies; 17+ messages in thread
From: Andreas Röhler @ 2013-04-05 17:51 UTC (permalink / raw)
  To: emacs-orgmode

Am 05.04.2013 18:31, schrieb Eric Schulte:
[ ... ]
> Yea, this could be a simple note, e.g., "the method by which variables
> are applied to code blocks are language-specific and determined by the
> semantics of the programming language of the code block, see ...".
>

Hi,

still can't see the purpose of this feature. OTOH expect an eternal trouble when re-implementing.
Even the notion what a variable is at all may differ a lot in languages.

If you define a syntax whose results are uncertain, only work from time to time, to a limited extend, it's better to rely on
native source code.

Best,

Andreas

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: Org-mode as a metalanguage: calling SQL "functions"
  2013-04-05 16:31                     ` Eric Schulte
  2013-04-05 17:51                       ` Andreas Röhler
@ 2013-04-06 20:44                       ` Bastien
  1 sibling, 0 replies; 17+ messages in thread
From: Bastien @ 2013-04-06 20:44 UTC (permalink / raw)
  To: Eric Schulte; +Cc: Orgmode Mailing List, Gary Oberbrunner

Eric Schulte <schulte.eric@gmail.com> writes:

> Alternately this could be a page on Worg, but I think it is
> important enough to be included in the manual.

Agreed.  In such cases, Worg can be used as a "sand-box" for fast
writing and quick review by others.  Then when the doc is mature 
enough, a patch against the manual would do.  Just to say: feel
free to use Worg in this "agile" perspective.

-- 
 Bastien

^ permalink raw reply	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2013-04-06 20:44 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-04-01 19:28 Org-mode as a metalanguage: calling SQL "functions" Gary Oberbrunner
2013-04-01 20:41 ` Mike Gauland
2013-04-02  1:19 ` Eric Abrahamsen
2013-04-02  1:45   ` Eric Schulte
2013-04-02  2:46     ` Eric Abrahamsen
2013-04-02  2:54     ` Gary Oberbrunner
2013-04-02 21:54       ` Eric Schulte
2013-04-03  5:50         ` Andreas Röhler
2013-04-03  5:54         ` Carsten Dominik
2013-04-03 13:09           ` Eric Schulte
2013-04-04 12:26             ` Sebastien Vauban
2013-04-04 12:49               ` Eric Schulte
2013-04-04 20:10                 ` Sebastien Vauban
2013-04-05 15:43                   ` Gary Oberbrunner
2013-04-05 16:31                     ` Eric Schulte
2013-04-05 17:51                       ` Andreas Röhler
2013-04-06 20:44                       ` Bastien

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).