Extra import needed for Lightweight Testing

Bug #599189 reported by Ian Price
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Scheme Libraries
Wishlist
Unassigned

Bug Description

Whenever I want to use SRFI 78 (Lightweight Testing), I also have to import SRFI 42 (comprehensions). While understandable, I think this is an unnecessary dependency to expose to the user who should only need to import SRFI 78. Otherwise, I think this behaviour should be documented, so that others aren't put off from using SRFI 78 thinking that it's buggy.

REPL example

> (import (srfi :78))
> (check (+ 1 1) => 2)

(+ 1 1)
=>
2
;; correct
> (check-ec (: i 10) (+ 1 1) => 2)
Unhandled exception
 Condition components:
   1. &message: "invalid syntax"
   2. &syntax:
       form: (:until-1 (do-ec:do (ec-guarded-do-ec stop (nested (:let equal-pred eq-p) (:let expected-result 2) (:let actual-result (let () (+ 1 1))) (begin (set! cases (+ cases 1))) (if (not (equal-pred actual-result expected-result)))) (begin (set! result (list (list 'let (list) '(+ 1 1)) actual-result expected-result cases equal-expr)) (set! stop #t)))) stop)
       subform: #f
   3. &trace: #<syntax (:until-1 (do-ec:do (ec-guarded-do-ec stop (nested (:let equal-pred eq-p) (:let expected-result 2) (:let actual-result (let () (+ 1 1))) (begin (set! cases (+ cases 1))) (if (not (equal-pred actual-result expected-result)))) (begin (set! result (list (list 'let (list) '(+ 1 1)) actual-result expected-result cases equal-expr)) (set! stop #t)))) stop)>
> (import (srfi :42))
> (check-ec (: i 10) (+ 1 1) => 2)

(check-ec (: i 10) (+ 1 1) (=> equal?) 2 ())
=>
#<void>
;; correct (10 cases checked)
>

likewise, if I run a test file using scheme-script I get

Unhandled exception:
 Condition components:
   1. &who: :
   2. &message: "unbound identifier"
   3. &undefined
   4. &source-position:
       file-name: "fooo.ss"
       character: 83
   5. &trace: #<syntax : [char 83 of fooo.ss]>

unless I import both SRFIs.

All examples tested with Ikarus Scheme version 0.0.4-rc1+ (revision 1870, build 2010-05-26) and revision 95 of the SRFI libraries.

Revision history for this message
Derick Eddington (derick-eddington) wrote :

The SRFI-78 document does not specify that any SRFI-42 bindings be provided, which is why they're not exported from (srfi :78). SRFI-78 only uses the <qualifier>s of SRFI-42, so I think it'd be improper to have (srfi :78) export all of SRFI-42. I think it'd be OK to have (srfi :78) export the <qualifier>s of SRFI-42.

Changed in scheme-libraries:
status: New → Confirmed
importance: Undecided → Wishlist
Revision history for this message
Ian Price (ianprice90) wrote :

Yes, you're right. I should have been more specific

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers