On Mon, Oct 12, 2009 at 01:10:08PM -0400, John Cowan wrote:
> (Consolidated reply)
> 
> Peter Bex scripsit:
> 
> > What added benefit do feature groups have?  If the module cannot be
> > defined because a feature is not implemented, what happens?  Is that
> > an error?  I'm asking because I suppose it would also be an error to
> > define a module containing references to undefined identifiers.
> 
> Quite so.  However, several feature groups (%bignums, %rationals,
> %ieee-float) don't bind any identifiers.  Also, being allowed to declare
> feature groups up front allows for fail-fast behavior: you find out when
> you import the module that it won't work on your Scheme, not when you
> try to call procedures in it.

Is that the only use case? In that case I'd just put something like the
following at toplevel:

(cond-expand (not %bignums)
  (error "Sorry, but this package requires bignum support"))

This should also throw an error at import time.  If you wish
"compile-time" errors, the same effect could be achieved by calling
a macro (maybe "error*"?) that throws an error at compile-time.

Cheers,
Peter
-- 
http://sjamaan.ath.cx
--
"The process of preparing programs for a digital computer
 is especially attractive, not only because it can be economically
 and scientifically rewarding, but also because it can be an aesthetic
 experience much like composing poetry or music."
                                                        -- Donald Knuth

Attachment: pgpCs6MJwuVrU.pgp
Description: PGP signature

_______________________________________________
r6rs-discuss mailing list
[email protected]
http://lists.r6rs.org/cgi-bin/mailman/listinfo/r6rs-discuss

Reply via email to