[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Scheme-reports] programs and cond-expand

On Fri, Oct 25, 2013 at 12:53 AM, Michael Montague <mikemon@x> wrote:
My reader includes location information when it reads identifiers and
quote strips all that out. I want that to be part of the tests and I
want to be able to test for specific errors. I will put more thought
into it and figure out a way to make my tests work in (chibi test).

It's not really possible without implementation-specific
extensions, because the error is happening at compile
time, and there's no standard way to catch compile-time

You could write a low-level macro that evaluates it's body:

(define-syntax test-syntax
    (lambda (expr rename compare)
      (guard (else (exn '(test-assert "syntax bad" #f)))
        (eval expr)
        '(test-assert "syntax ok" #t)))))

and maybe preserve the source info there, but it's still
just falling back on eval.

As an implementation-specific extension you could provide
a syntax-guard form which can catch macro errors, which
would be a cleaner solution.


Scheme-reports mailing list