improved ASSERT interface
This commit is contained in:
parent
85539d1d46
commit
9ef33b4651
|
@ -32,16 +32,15 @@ structure KRIMS -- Odds and Ends
|
|||
The structure KRIMS gathers miscellaneous tiny utilities mainly for use
|
||||
of other sunterlib projects.
|
||||
|
||||
(assert [id] exp) SYNTAX
|
||||
(assert exp x0 ...) SYNTAX
|
||||
|
||||
The usual ASSERT macro with an optional ID tag: Signal an error and
|
||||
complain if EXP evaluates to false. The error message contains the
|
||||
value of ID (if supplied) and the expression EXP. [ ASSERT being a
|
||||
macro, we can change it to the trivial form that doesn't evaluate its
|
||||
arguments and recompile before selling our stuff ... ]
|
||||
Signal an error if EXP is false, reporting both the failed assertion EXP
|
||||
(literally) and the values of X0 ... Don't evaluate X0 ... if EXP holds
|
||||
true.
|
||||
|
||||
*
|
||||
|
||||
|
||||
(receive/name loop formals exp form0 ...) SYNTAX
|
||||
|
||||
RECEIVE/NAME is a multi-values analogue of named LET (but much less
|
||||
|
|
|
@ -4,11 +4,8 @@
|
|||
|
||||
(define-syntax assert
|
||||
(syntax-rules ()
|
||||
((assert ?x)
|
||||
(if (not ?x) (error "Assertion failed" '?x)))
|
||||
((assert ?tag ?x)
|
||||
(if (not ?x) (error (format #f "~a -- assertion failed" ?tag)
|
||||
'?x)))))
|
||||
((assert ?x ?y0 ...)
|
||||
(if (not ?x) (error "Assertion failed" '?x ?y0 ...))) ))
|
||||
|
||||
|
||||
;; RECEIVE/NAME is a multiple values analogue of named LET.
|
||||
|
|
Loading…
Reference in New Issue