On 8/4/05, Michael Benfield <[EMAIL PROTECTED]> wrote:
> Hi -
> 
> I'm pretty new to Scheme in general and Chicken in particular. Both are
> awesome.

Thanks for giving it a try!

> 
> I'm wondering, though, is it possible to catch the errors generated by
> functions like read or load when they encounter bad syntax? I'd like to
> be able to use read to parse things or load to load files from within
> my program, but I can't do that if bad user input will just terminate
> my program. Or is there a different way to do this?
> 

You could simply use exception-handling:

(handle-exception ex (...do something with the exception in "ex" ...)
  (read) )

Or, alternatively `condition-case', see also:

http://www.call-with-current-continuation.org/manual/Exceptions.html#Exceptions

Read errors normally raise an exception of tthe kinds 'exn and `syntax.


cheers,
felix


_______________________________________________
Chicken-users mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/chicken-users

Reply via email to