guile-devel
[Top][All Lists]
Advanced

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

Proposal: deprecate low-level numeric predicates


From: Mark H Weaver
Subject: Proposal: deprecate low-level numeric predicates
Date: Tue, 01 Mar 2011 14:20:58 -0500

Daniel Llorens <address@hidden> writes:
> I tried to look into SCM_VALIDATE_REAL per the comment, I didn't get
> far.

Yes, SCM_VALIDATE_REAL (defined in validate.h) requires that the tested
value be an inexact real, i.e. floating-point.  It will reject exact
integers or exact rationals.  It really ought to be deprecated in
master, and replaced with a new validator that uses scm_is_real.

SCM_REALP and SCM_COMPLEXP should also be deprecated.  It is very
confusing that these macros do not correspond to `real?' and `complex?'.
They should be replaced with renamed versions to reflect the fact that
they are testing for particular low-level numeric representations.
Maybe SCM_DOUBLE_P and SCM_COMPLEX_DOUBLE_P.  In the future, Guile will
support additional representations for inexact reals, for example
arbitrary-precision floating-point numbers.

SCM_NUMBERP, SCM_NUMP, and SCM_INEXACTP ought to be deprecated, and
replaced with internal versions.  They check only for representations
supported by the core implementation, and do not properly support GOOPS
numeric classes (part of an upcoming patch series I'm working on).

SCM_VALIDATE_NUMBER ought to be changed to use scm_is_number, in order
to support GOOPS numeric classes.

What do you think?

    Mark



reply via email to

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