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

Slightly nicer error message when a body is all definitions. #18

Closed
wants to merge 1 commit into from

Conversation

stamourv
Copy link
Collaborator

Currently, this program:

#lang dssl2
def foo():
    def bar():
        3

raises an error in terms of the Racket expansion.

The PR catches these kinds of errors, and produces a slightly nicer error message.

Two issues that remain:

  • I couldn't get it to print the actual DSSL2 surface syntax where the error is, but rather the AST version.
  • I didn't add the above program as a test; do you have tests for syntax errors? I didn't find any.

@tov
Copy link
Owner

tov commented Aug 26, 2020

I don't think I do have syntax error tests…

@tov
Copy link
Owner

tov commented Aug 26, 2020

Is it necessarily wrong to end with a definition? Instead of improving this error message, maybe we should make the result None in that case.

@stamourv
Copy link
Collaborator Author

Is there a non-mistake situation where you have definitions, but no expression in the body?
I'd imagine that that error would catch a lot of oversights, e.g., missing recursing starting point.

@tov
Copy link
Owner

tov commented Sep 6, 2020

It’s never ultimately useful, but there are definitely cases where you could temporarily have a definition last in a block. And notably, Python allows it.

@stamourv
Copy link
Collaborator Author

stamourv commented Sep 6, 2020

Alright, either way works for me.
The more time-sensitive PR is the other one anyway. Any ETA on that one?

@tov
Copy link
Owner

tov commented Sep 8, 2020

So it turns out it wasn’t just def that did this—let-with-no-RHS, struct, class, and interface did as well. I implemented my solution on a branch, block-end-fix. If you’re happy with that then I’ll merge it.

@stamourv
Copy link
Collaborator Author

stamourv commented Sep 8, 2020

That looks fine, I'm happy with that.
No tests?

@tov
Copy link
Owner

tov commented Sep 8, 2020

Yeah, okay, a couple tests.

tov added a commit that referenced this pull request Sep 8, 2020
This is in lieu of pull request #18 (see
<#18>).
@tov tov closed this Sep 9, 2020
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

Successfully merging this pull request may close these issues.

None yet

2 participants