chicken-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Chicken-users] RecordType operations and parameter types


From: Bahman Movaqar
Subject: Re: [Chicken-users] RecordType operations and parameter types
Date: Wed, 07 Jan 2015 18:57:17 +0330
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.3.0

On 01/07/2015 06:50 PM, Alex Charlton wrote:
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

Thanks Richard and Alex for your replies and hints. For now as a beginner, to keep the complexity at a minimum, I'd go with the traditional "assert".

-- 
Bahman Movaqar

http://BahmanM.com - https://twitter.com/bahman__m
https://github.com/bahmanm - https://gist.github.com/bahmanm
PGP Key ID: 0x6AB5BD68 (keyserver2.pgp.com)

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]