[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Chicken-users] RecordType operations and parameter types
From: |
Alex Charlton |
Subject: |
Re: [Chicken-users] RecordType operations and parameter types |
Date: |
Wed, 07 Jan 2015 10:20:23 -0500 |
User-agent: |
mu4e 0.9.9.5; emacs 24.4.50.1 |
Bahman Movaqar writes:
> I have a record type, SOME-RT, and am implementing operations for it. As
> a habit, I keep putting an 'assert' expression at the beginning of each
> procedure.
>
> (define (some-rt-some-op param1)
> (assert (some-rt? param1) ...)
>
> However, I doubt if I'm doing things the idiomatic way. Is this the
> approach you seasoned CHICKEN'ers would take as well? TIA,
While I wouldn’t say assert is in any way a bad thing to use, Eiffel-style
contracts can be a nice solution to this type of problem. While I’ve never used
the dbc egg before, it seems to be the way to go for contracts in CHICKEN:
http://wiki.call-cc.org/eggref/4/dbc
--
Alex