This is the mail archive of the guile@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]

Re: Additions to the gh_ interface.



> > Hmm... that's an idea.  The conversion process does produce the
> > information that you want to put into *FLAGS, as a side effect.
> > Granted that Guile should provide some way to discover whether a
> > Scheme number can be accurately converted to a particular C type, is
> > this the best interface?  What would you do if you got an OVERFLOW,
> > besides raise an error?
> 
> Well, you could 
> - issue a more detailed error message with SCM_ASSERT
> - do some cleanup on the heap before actually raising the error
> - just provide a default value to perform the computation with
> 
> You could even decide to perform the desired computation with guile's
> bignums. ...hm...think... Hey, that raises a good question: are guile's
> bignums accessible from the C level? If so, then there could also be a
> conversion gh_scm2bignum or similar. I think some days ago someone
> suggested that guile used some GNU bignum package. In this case, the user
> could provide two implementations: a fast one with C data types and a
> fallback with bignums.

Okay.  I think, in most cases, people just want a long they can frob,
and want the type error raised for them by default.  However, people
who do want to take the trouble should certainly be able to, so we
need some function for this.

There may even be one; I certainly don't know the bignum code inside
and out.

I don't know how easy bignums are to manipulate from C code.  By
Aubrey's reputation, the primitives present are probably exactly the
right ones for SCM's purposes, but not what you'd expect for other
purposes.