[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Chicken-users] Rough proposal for contracts in Chicken
From: |
felix winkelmann |
Subject: |
Re: [Chicken-users] Rough proposal for contracts in Chicken |
Date: |
Wed, 20 Dec 2006 19:14:55 +0100 |
On 12/19/06, John Cowan <address@hidden> wrote:
I've read over the PLT Scheme approach, and I think I see how it can be
adapted to Chicken. Basically, the syntax of the export declaration is
extended to provide per-procedure argument and result checking, and a
new declaration is added to provide module invariants.
[...]
What do you think?
I like this very much. But wouldn't it be better to use a new form, instead
of adding yet more functionality to "declare"? Perhaps a catchall "contract"
macro, that performs per-file declarations (possibly with support by
the compiler, possibly be doing the very (declare (export ...)) behind
the scenes):
;;; some file
(contract
(export
(plus (-> (number? number?) number?))
(plus/all (-> (number? . (list-of number?)) number?))
(exact->div0+mod0 (-> (exact? exact?) (exact? exact?))))
(invariant ...))
...
Hm... there might be better approaches. Anyway, you specified
semantics that look good to me, I just would like to avoid using
"declare" for this purpose.
cheers,
felix