This is the mail archive of the
guile@sourceware.cygnus.com
mailing list for the Guile project.
Re: SCM_VALIDATE_...
Jim Blandy <jimb@savonarola.red-bean.com> writes:
> Clearly, SCM_REAL_P should be implemented by invoking a real? generic
> function, which the module adding these new representations can
> define...
Yes, this is one possibility, and there might be others.
The purpose of the value-oriented real test is simply to check if the
class of the value is a subclass of <real>. If, e.g., we decide that
this test needs to be efficient, we simply dedicate a class flag for
reals and write
#define SCM_REALP(x) \
(SCM_CLASS_FLAGS (scm_class_of (x)) & SCM_CLASSF_REAL != 0)
Probably, not all value oriented tests needs to be this generic,
though, since we can "seal" some classes against subclassing. E.g.,
we should probably not allow people to create subclasses of <integer>.