[r6rs-discuss] Proposed features for small Scheme, part 9: modules
Peter Bex
Peter.Bex at xs4all.nl
Mon Oct 12 15:18:27 EDT 2009
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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 478 bytes
Desc: not available
Url : http://lists.r6rs.org/pipermail/r6rs-discuss/attachments/20091012/12587e9c/attachment.pgp
More information about the r6rs-discuss
mailing list