[plt-scheme] contract questions--convention for "any" conflict and inline documentation
I'm new to contracts, and had a couple of questions for the community:
(1) If I try to do a simple (require scheme/contracts), I run up
against a conflict with SRFI-1 "any" and the contract "any". I'm
doing this right now, but was wondering if this was a common enough
issue that a convention has been established:
(rename-in scheme/contract
(any c:any))
(2) I like the idea of using contracts as a way of augmenting the
documentation of a function. My vision is to do use a convention like
this for certain functions:
;;
;; my-great-fn
;;
;; squares any number you give it.
;;
(provide/contract (my-great-fn (-> number? number?)))
;;
(define (my-great-fn n)
(* n n))
This is all well and good, except that I can no longer have
my-great-fn in the (provide ...) form at the top of my module. I
really like provide as an "always there" source of documenting what
this module provides. So, I'm considering using the following
"comment convention", but does anyone have a better idea?
#lang scheme/base
(require ...)
(provide
something
something-else
;; provided with contracts:
;; my-great-fn
)
... impl ...
Thanks!
Rob