guile-devel
[Top][All Lists]
Advanced

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

Re: scm_num2float() ?


From: Michael Livshin
Subject: Re: scm_num2float() ?
Date: 04 Sep 2001 01:34:07 +0300
User-agent: Gnus/5.0808 (Gnus v5.8.8) XEmacs/21.4 (Copyleft)

Dirk Herrmann <address@hidden> writes:

> 1) Type conversion for some C type T requires the conversions T->number
> and number->T.  The number->T conversion should do some range checking to
> see, whether the number fits into the desired range.  From a C programmers
> view, however, it should be possible to check in advance whether a
> conversion number->T would work, because otherwise it is necessary to set
> up an error catcher or do the range check by hand, using some scm_less_p
> checks.  Since this is inconvenient, IMO together with the conversions
> T->number and number->T we should provide some number_fits_into_T_p
> predicate.  (Then, again, one could argue that number->T wouldn't need to
> do the range checks, because the user is responsible for doing them.  
> Another alternative is to provide two variants of the number->T conversion
> function:  A type and range checking one, and one that does no
> checks.)

another alternative is to provide, together with the simple number->T
function, a more flexible function like

int scm_num2foo_ext (SCM num, foo *res);

which would return 1 on success and 0 on failure.  then the
`scm_num2foo' thingies would just wrap those.

-- 
:FATAL ERROR -- ILLEGAL ERROR-




reply via email to

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