-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
Consistently use quotes in parsing errors #4762
Conversation
|
OK, so But as regards |
Because the error in that case is that there are too many dots, and the extra dot has not been added to the output string yet. It should say
not
|
Funny, I had tried everything but not two dots. So my patch works! |
Please rebase. |
Use quotes around identifier and operators, as well as around parsed expressions to make understanding messages easier. This commit only deals with src/ files.
The last version deals with all files in src/. I think base/ can wait. ;-) |
Ok, I think this is more changes than I'm comfortable with. It also breaks a test. For parse errors, quoting makes sense because you are quoting back the user's input text. But I don't think it makes sense in all of these cases. For one thing, quoted strings are also part of the language, so there is confusion about whether you are referring to a string or some other kind of value. Quoting function names every time they're used just looks weird. |
Sure, there's no hurry, we can discuss the rules you want to apply before merging anything. Maybe a better rule would be to use double quotes for user-typed expressions (meaning: "you typed that, I cannot be sure what you meant") and single quotes for keywords that have been identified as something in the language (control flow, types, functions...). (I don't think the confusion with String is possible, since error messages rarely, if ever, print String objects as such.) I've quoted functions and names part of the language because I found some could be confusing in some messages, in particular
vs
That's the case with many several keywords or functions ( Though I agree that messages of the form "function: an error message" do not gain anything by adding quotes around "function" - we could make an exception for them. |
I'm willing to merge the version that just changes the parse errors. |
Use quotes around identifier and operators, as well as around
parsed expressions to make understanding messages easier.
This is a change I felt the need for after getting a message like
which is much clearer as
This can be even more useful when a weird user-typed expression that could not be parsed is printed.
I've reused the convention to use double quotes, which I found in one string. Another string used single quotes around
:
. If you prefer single quotes in some cases, and double quotes in other, I can adapt the commit. But I find such a convention very hard to respect in a large code base, let alone package authors.I'm not familial at all with Scheme, so I hope I've not broken anything. Most cases are simple, but you should probably have a look at the lines I changed that contain
#\.
and':
(i.e. line 206 and line 534).