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: Kon Lovett
Subject: Re: [Chicken-users] RecordType operations and parameter types
Date: Wed, 7 Jan 2015 08:50:49 -0800


On Jan 6, 2015, at 4:16 AM, Bahman Movaqar <address@hidden> wrote:

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,

Yet another style using the http://wiki.call-cc.org/eggref/4/check-errors egg:

(use type-checks)

; creates ‘check-some-rt’ & ‘error-some-rt’ functions
; see documentation for options
(define-check+error-type some-rt)

 (define (some-rt-some-op param1)
    (check-some-rt ‘some-rt-some-op param1 ‘param1)
    ...)

;check fail will signal a SRFI 12 composite condition (exn type) with properties location=some-rt-some-op, arguments=(<value of param1>), & message=“bad param1 argument - not a some-rt”. The argument identifier is optional.
_______________________________________________
Chicken-users mailing list
address@hidden
https://lists.nongnu.org/mailman/listinfo/chicken-users


reply via email to

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