Skip to content
This repository has been archived by the owner on Oct 8, 2022. It is now read-only.

Improve error message for default nanopass-case message #35

Open
soegaard opened this issue Jul 19, 2015 · 4 comments
Open

Improve error message for default nanopass-case message #35

soegaard opened this issue Jul 19, 2015 · 4 comments

Comments

@soegaard
Copy link

When nanopass-case is called with a value V that no clauses match and there is no default else-clause the error message doesn't show the value V. The entire form is printed. Note that the DrRacket seems to color more than the nanopass-case expression red - which suggest that the source location is not correct.

Example of error message:

nanopass-case: empty else clause hit (nanopass-case (LFE2 GeneralTopLevelForm) T 
((unquote e) (Expr e id)) ((define-values (unquote s) ((unquote x) ...) (unquote e)) 
(quasiquote (define-values (unquote s) ((unquote x) ...) (unquote (RHS e id))))) 
((define-syntaxes (unquote s) ((unquote x) ...) (unquote e)) (quasiquote (define-syntaxes 
(unquote s) ((unquote x) ...) (unquote (RHS e id)))))) 
<pkgs>/nodejs/nodejs/compiler.rkt:804.6
@soegaard
Copy link
Author

Also: It would be nice if unquote were printed as , in the error message.

@akeep
Copy link
Owner

akeep commented Jul 19, 2015

Unfortunately, I don't think we have control over that:

-> (format "~s" '(a ,b ,c))
"(a (unquote b) (unquote c))"

unless there is a parameter to change how format works. Otherwise, we'd need to write our own format/pretty printer for s-expressions (which is doable but kind of a pain).

-andy:)

On July 19, 2015 at 9:44:15 AM, Jens Axel Søgaard ([email protected]) wrote:

Also: It would be nice if unquote were printed as , in the error message.


Reply to this email directly or view it on GitHub.

@soegaard
Copy link
Author

The ~v uses the current printer, which default to right thing:

> (format "~v" '(a ,b ,c))
"'(a ,b ,c)"

(error 'foo "the value is: ~v" '(if '1 '2 ,3))
foo: the value is: '(if '1 '2 ,3)

@akeep
Copy link
Owner

akeep commented Jul 19, 2015

Cool... I was unaware of ~v I'll go through and use that places where we print s-expressions.

-andy:)

On July 19, 2015 at 10:48:57 AM, Jens Axel Søgaard ([email protected]) wrote:
The ~v uses the current printer, which default to right thing:

(format "~v" '(a ,b ,c))
"'(a ,b ,c)"

(error 'foo "the value is: ~v" '(if '1 '2 ,3))
foo: the value is: '(if '1 '2 ,3)


Reply to this email directly or view it on GitHub.

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

No branches or pull requests

2 participants