GnuCash reports via eguile - probably not

Chris Dennis cgdennis at btinternet.com
Wed Jan 21 11:40:30 EST 2009


Derek Atkins wrote:
> Chris Dennis <cgdennis at btinternet.com> writes:
> 
>>> I'd encourage "you" to not add another layer of formatting or
>>> translation.  Just have the template iterate over objects, call
>>> accessors and format data for rendering.
>> Can you explain exactly what you mean by that last sentence please?
> 
> I think he means "make the template smart".

Yes, but how?

> So why can't we supply an environment?
> Instead of running eval-string directly maybe we can use something else?
> Or build an environment around it, or a thunk that we could supply?

I've boiled the problem down to this:

----
;#! /usr/bin/guile
(define fred "This is Fred")
(define (foo bar)
   (display fred) (newline) (display bar) (newline)
   (display "and now via eval-string...") (newline)
   (let ((string1 "(display fred) (newline) (display bar) (newline)"))
     (eval-string string1)))
(foo "Actual parameter")
----
gives this output:
----
This is Fred
Actual parameter
and now via eval-string...
This is Fred
ERROR: Unbound variable: bar
----

So the global variable 'fred' does exist in the eval-string environment, 
but the parameter 'bar' doesn't (or rather its value isn't available).

Can any Guile/Scheme experts help?

cheers

Chris
-- 
Chris Dennis                                  cgdennis at btinternet.com
Fordingbridge, Hampshire, UK


More information about the gnucash-devel mailing list