Reporting system - declarative

Yawar Amin yawar.amin at
Sat Jul 9 18:05:48 EDT 2011

Hi John,

On 2011-07-08, at 23:33, John Ralls wrote:

>> […]
> Fun. Two questions: Can that be easily converted into a string parser so that normal users aren't put off by the extra parentheses,

I guess we could replace all the parens with more HTML-reminiscent characters like << and >>, so you’d get stuff like (btw I’m using dots to represent spaces everywhere as my MUA is eating up the first blank space on every line):

<<report ...
....<<def-date ...>>
....<<def-date ...>>

then do a search-and-replace to turn that back into Scheme. We might overcome a lot of phobia if we hide the fact that we’re really making them write Scheme :-)

Another thing we could recommend is lining up the parens below the function names on multi-line function calls. I mean:

(report ...
....(def-date ...)
....(def-date ...)

In the beginning I found it a lot more digestible when I didn’t have to deal with the mess of ‘)))))))’.

> and is there anything about that that works in Scheme but not in C?

I really, really don’t want to deal with memory management….

Anyway, I kind of mercilessly hacked the ‘Hello, World’ report that comes with GC, in share/gnucash/guile-modules/gnucash/report/hello-world.scm, and wrote a few functions which do what I was talking about. So now I’m able to say:

"income-statement" ; name
0 ; defs
; Have to keep this title while experimenting in the sample report that
; comes with GnuCash
"Hello, World" ; title
"2011-01-01 to 2011-07-31" ; subtitle
(d:filter-none ; body
  (d:p "Some text.”)
  (d:p "A little more text.")))

… and that generates the report that you’d expect. The ‘d:’ (‘declarative’) prefix is just to make sure I don’t clash with anything. Code is up on (I'm not pushing anything which causes a crash for me, so it should be reasonably safe. But caveat emptor).



-------------- next part --------------
A non-text attachment was scrubbed...
Name: PGP.sig
Type: application/pgp-signature
Size: 194 bytes
Desc: This is a digitally signed message part
URL: <>

More information about the gnucash-devel mailing list