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

Improve errors by saving expanded versions within variants of a macro #3

Open
AlexKnauth opened this issue Mar 29, 2017 · 0 comments
Open

Comments

@AlexKnauth
Copy link
Collaborator

For example in a function application macro:

(define-typed-syntax app
  [(_ f a ...) ≫
   [⊢ f ≫ f- ⇒ (~→ τ_a ... τ_out)]
   ....]
  [(_ f a ...) ≫
   [⊢ f ≫ f- ⇒ (~case→ τ_f ...)]
   ....])

If the f- result from the first variant can be used as the f- result for the second, then error reporting improves dramatically, because syntax-parse can recognize that the ~→ and the ~case→ pattern are checking the same syntax object, and it can correctly report the error in terms of the one that made the most progress.

Without this "saving" (it's not caching because it's meant to change behavior), you get bad syntax a lot more often, but with this saving, you get the same error messages you would if you put ~!s within the patterns.

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

1 participant