This is the mail archive of the guile@sourceware.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: SCM_VALIDATE_...


Mikael Djurfeldt <mdj@mdj.nada.kth.se> writes:

> Dirk Herrmann <dirk@ida.ing.tu-bs.de> writes:
> 
> It seems most reasonable to change the name of SCM_REALP et al, don't
> you think?

In addition, if we think about what kind of operations are useful, not
paying regard to their current names:

scm_real_p is an R5RS primitive
In GOOPS, <real> is a superclass of <integer>.

In both cases, we want to treat integers and floting point numbers in
the same way.

If we think about possible uses in an application, the macro which
before your change was called SCM_VALIDATE_NUMBER_COPY supplies the
same kind of functionality.

The current SCM_VALIDATE_REAL, however, seems not useful at all.

On the other hand, SCM_REALP is useful when dispatching on types in
order to treat them differently, while the macro which would
correspond to scm_real_p isn't useful at low level.  You very seldom
need to check if something is either and integer or a real at that
level, and, if you do, it's simple to combine SCM_INUMP and SCM_REALP
in a logical expression.

One alternative is to change the current SCM_VALIDATE_REAL to conform
to the new SCM_VALIDATE_REAL_COPY (old SCM_VALIDATE_NUMBER_COPY) and
simply accept the inconsistency...

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]