This is the mail archive of the
guile@sourceware.cygnus.com
mailing list for the Guile project.
Some suggestions for guile
- To: guile at sourceware dot cygnus dot com
- Subject: Some suggestions for guile
- From: Joris van der Hoeven <TeXmacs at math dot u-psud dot fr>
- Date: Sat, 25 Mar 2000 19:44:20 +0100 (MET)
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