Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not all errors captured by with-exception-handler #5

Open
Retropikzel opened this issue Jan 3, 2025 · 2 comments
Open

Not all errors captured by with-exception-handler #5

Retropikzel opened this issue Jan 3, 2025 · 2 comments

Comments

@Retropikzel
Copy link

Given code:

(import (scheme base)
        (scheme write))

(define f
  (call-with-current-continuation
    (lambda (k)
      (with-exception-handler
        (lambda (exc)
          (k #f))
        (lambda ()
          (vector-ref (vector) 100))))))

(display "Value of f is: ")
(display f)
(newline)

Run with for example Chibi, Guile or Kawa gives output:

Value of f is: #f

but run with skint I get an error:

run-time failure: argument is not a valid vector index:
100

If I switch line 11 with:

(error "Hello")

then Skint gives me right output. I would expect all errors to be captured.

@dermagen
Copy link
Contributor

dermagen commented Jan 4, 2025

Sorry, but I think your expectations are wrong. R7RS-small has a very limited class of errors that have to be signalled, e.g. opening an input file that does not exist, and those are described with exact kind of exceptions that need to be raised. The rest are just "an error"s that the implementation can handle in any way it pleases.

@Retropikzel
Copy link
Author

I might be wrong. My expectations come from other implementations, Chibi, Chicken 5 (with r7rs library), Cyclone, Foment, Gambit, Gauche, Guile, Kawa, mit-scheme, Mosh, Racket (with r7rs library), Sagittarius, STklos, tr7 and Ypsilon give the output Value of f is: #f.

I tested also with

(define f
  (guard (error (else #f))
    (vector-ref (vector) 100)))
 

And got same results.

For context I'm trying to make some implementation of "SRFI-64: A Scheme API for test suites" portable. The SRFI contains test-error procedure which should test if given code errors. Running tests on the SRFI on other implementations works on that part. But Skint stops, so I thought to open an issue about it.

I'll add an exception to the tests for Skint or change them to use (error..) instead of vector access. This issue can be closed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants