guile-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Doc organization (Re: Around again, and docs lead role)


From: Viktor Pavlenko
Subject: Re: Doc organization (Re: Around again, and docs lead role)
Date: Tue, 13 May 2003 21:07:15 -0400

>>>>> "NJ" == Neil Jerram <address@hidden> writes:

    NJ> I don't follow this.  What is wrong with the following?

    NJ> In C:
    NJ>    scm_call_1 (scm_c_lookup ("my-func"), str);

    NJ> In Scheme:
    NJ>    (define (my-func str)
    NJ>      (catch #t
    NJ>        (lambda ()
    NJ>          ... whatever ...)
    NJ>        (lambda (key . args)
    NJ>          ... handle errors ...

... and tell the calling C function about the error somehow...

    NJ>                               )))

But the exception mechanism is much more advanced.

I use scm_internal_catch to convert guile exceptions to C++, and try
{...} catch () { scm_throw(); } in gsubr to convert C++ exceptions to
guile. I call guile and C++ procedures from one another and, since
it's a C++ program that uses guile as extension, have to deal only
with C++ exceptions. A guile script would receive just guile errors.

IMO, error handling mechanism in guile's C API is great, it just needs
some docs and examples.

Re. encouraging people to do more things in Scheme, I agree, but not
by taking away a possibility to do it in C.

Just my opinion.

-- 
Viktor




reply via email to

[Prev in Thread] Current Thread [Next in Thread]