[plt-scheme] Contract Comments / Suggestions / Requests

From: Williams, M. Douglas (M.DOUGLAS.WILLIAMS at saic.com)
Date: Tue Oct 19 11:50:18 EDT 2004

I have a couple (of rather trivial) comments / suggestions / requests
(however anyone wants to interpret them) for contracts.  In general, these
are nitpicks that I can (and do) implement on my own (except for #4).  But I
think they might useful enough to include in the contracts module - or at
least it keeps me from including my own contracts-extension module.


1) There are places in the language that require exact integers (e.g.,
pretty much anyplace an index into something is needed).  How about exact
counterparts to the contracts that match integers.  For example,
(exact-integer-in 1 10) or exact-natural-number?.  [Also add exact-integer?
as a counterpart to integer?.]


2) This is a total nitpick.  I would have rather seen natural-number? named
natural? (or natural-integer?).  I think the -number appended makes it look
to someone new to the language that it is higher in the numeric hierarchy
than it really is.  Plus, the exact-natural-number? in #1 is getting a bit


3) At first I thought that in addition to natural-number? it would be nice
to have something matching positive integers, etc.  But I've gotten so used
to writing (integer-in 1 +inf.0) that it seems natural (no pun intended).
Indeed, maybe natural-number? is superfluous.  Should we just encourage this


4) This one may not be so trivial.  Is there any way to dynamically check a
list that could potentially be used as a function call (or alternatively, a
function and list of arguments to be applied) against a contract, prior to
evaluation (or application) of the function?  (I am thinking a
super-extension of procedure-arity-includes? that one could use to check
against a contract instead of just the arity of the procedure.)



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20041019/d9cfd506/attachment.html>

Posted on the users mailing list.