record exceptions that are supposed to use &assertion
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Ikarus Scheme |
Fix Released
|
Low
|
Abdulaziz Ghuloum |
Bug Description
The R6RS says a number of exceptions raised by the record stuff are supposed to use &assertion, but currently &error is being used. I searched chapter 6 for "assertion" and I've made the below changes so things use &assertion where chapter 6 says they're supposed to. Also, I improved some of the exception messages, I made the opaque and sealed tests test for boolean equivalence per the report, and I removed the (eqv? name (rtd-name rtd)) because the report does not say to do that test and the returned nongenerative record type is always the first one which always prints the name of the first one anyways.
=== modified file 'scheme/
--- scheme/
+++ scheme/
@@ -55,7 +55,7 @@
(define (record-rtd x)
(define (err x)
- (error 'record-rtd "not a record" x))
+ (assertion-
(if ($struct? x)
(let ([rtd ($struct-rtd x)])
(if (rtd? rtd)
@@ -144,7 +144,7 @@
(cond
[(rtd? parent)
(when (rtd-sealed? parent)
- (error who "cannot extend sealed parent" parent))
+ (assertion-
(or opaque? (rtd-opaque? parent))
@@ -153,6 +153,9 @@
[else (error who "not a valid parent" parent)])))
+ (define (boolean-
+ (or (and (not x) (not y))
+ (and x y)))
(define (same-fields-
(let* ([fv (rtd-fields rtd)]
[n (vector-length fv)])
@@ -179,12 +182,13 @@
(lambda (rtd)
- (and (eqv? name (rtd-name rtd))
- (eqv? parent (rtd-parent rtd))
- (eqv? sealed? (rtd-sealed? rtd))
- (eqv? opaque? (rtd-opaque? rtd))
+ (and (eqv? parent (rtd-parent rtd))
+ (boolean-
+ (boolean-
- (error who "invalid arguments"))
+ (assertion-
+ "arguments not equivalent to nongenerative record type with the same uid"
+ parent sealed? opaque? fields))
rtd)]
[else
(let ([rtd (generate-rtd name parent uid sealed? opaque? fields)])
@@ -195,9 +199,9 @@
(unless (symbol? name)
(error who "not a valid record type name" name))
(unless (boolean? sealed?)
- (error who "not a valid sealed? argument" sealed?))
+ (error who "not a valid sealed argument" sealed?))
(unless (boolean? opaque?)
- (error who "not a valid opaque? argument" opaque?))
+ (error who "not a valid opaque argument" opaque?))
(cond
@@ -357,7 +361,7 @@
(unless (fx< i sz)
(error who "not a valid index" k))
(unless (car (vector-ref (rtd-fields rtd) k))
- (error who "field is not mutable" k rtd))
+ (assertion-
(let ([a-record-mutator
Changed in ikarus: | |
status: | Fix Committed → Fix Released |
On Dec 1, 2007, at 8:50 PM, Derick Eddington wrote:
> Public bug reported:
>
> The R6RS says a number of exceptions raised by the record stuff are
> supposed to use &assertion, but currently &error is being used.
I think this applies to almost all the errors that Ikarus currently
raises.
I will fix all of them at once at some time. Not today.
> I
> searched chapter 6 for "assertion" and I've made the below changes so
> things use &assertion where chapter 6 says they're supposed to.
> Also, I
> improved some of the exception messages,
OK. Thanks.
> I made the opaque and sealed
> tests test for boolean equivalence per the report,
eqv? and your boolean-equivalent? both return the same thing for
boolean values.
I don't see why you're making this change.
> and I removed the
> (eqv? name (rtd-name rtd)) because the report does not say to do that
> test and the returned nongenerative record type is always the first
> one
> which always prints the name of the first one anyways.
I don't know if this was intentional or by mistake. Will do as the
report says anyways.
Aziz,,,