This is the mail archive of the guile@sourceware.cygnus.com mailing list for the Guile project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Some suggestions for guile



Hi,

I have some suggestions for the gh_ interface in order
to make it easier to use guile as an interpreter in an extern application.
It would be nice to define two scheme-functions 'string->object' and
'object->string' in order to convert between arbitrary expressions and
strings. I used the following code for object->string:

       (define object->string
         (lambda (obj)
           (call-with-output-string
             (lambda (port) (write obj port)))))

It would be handy to have such routines available in 'gh.h'.
I also suggest to provide some extra error handling routines.
At the moment I use the following routines for evaluating
scheme-expressions without exiting on errors:

      (define TeXmacs-guile-error-handler
         (lambda args
           (object->string args)))

       (define object->string
         (lambda (obj)
           (call-with-output-string
             (lambda (port) (write obj port)))))

       (define TeXmacs-guile-eval
         (lambda (s)
           (catch
             #t
             (lambda ()
               (object->string (eval-string s)))
             TeXmacs-guile-error-handler)))

However, it took me quite a lot of time to figure out this code,
and I still do not know how to transform 'TeXmacs-guile-error-handler'
into a handler which prints a more comprehensive error message...
Again, it might be a good idea to provide a similar kind of simple
to use evaluation routine in 'gh.h', which is guaranteed not to exit.

Sincerely,

Joris van der Hoeven


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]