gh_ interface (Re: guile: going the way of DEATH)

Telford Tendys (telford@triangle.triode.net.au)
Fri, 14 Aug 1998 11:16:00 +1000

> > On the opposite, Guile was initially based on one implementation of
> > Scheme (SCM) with some pieces borrowed from another one. This led
> > to a horrible mix of interfaces and interdependencies in the code.
> > Also, nobody even tried to define both Scheme and C API - they are
> > still in flux and dirty, lacking logical order.
>
> This is a factual error. Mark Galassi took considerable care when
> designing the gh_ API, which is the application writer's C level
> interface to Guile. This interface has changed very little since it
> was defined. And IMHO the gh_ interface is logical. Please share a
> contradictory example.

You are writing C, you have a variable of type SCM and you want
to convert it to a double. You use gh_scm2double() and if the SCM
was a number then it will convert but if it was something else then
it will error trap and you don't want that.

So you check the value first with gh_inexact_p() but then you realise
that someone might send you an integer which you still want to convert
to a real so you have to check again with gh_exact_p(). Not a huge
demand I realise but I still use scm_number_p() instead because it is
one call instead of two <shrug>.

- Tel