-
-
Notifications
You must be signed in to change notification settings - Fork 1.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
[Low Priority] [Error Messages] Suggest case fix when an identifier is typed with the wrong case #9197
Comments
NHF, but even if you (general you) mistakenly think Nim has total case-insensitivity and you declare/call your procs with uppercase first letter, "you gonna have a bad time", and you deserve it by breaking the usual conventions! What if you had type Foo = object
a: int
proc foo(a: int): int = 42
let a = Foo(3) What is the error here? Did you wrongly call your object (should have been |
Well, like I said, eventually the best thing to do would be to have a list of possible calls you meant to use (which would likely include object ctors). But for this issue specifically I was thinking of just procedure calls. (I admit sometimes I will get confused of whether or not I'm using the right case when it comes to say, bindings to a library that uses PascalCase for procedures - did whoever implement the bindings change these to camelCase? Granted, this is a not a huge deal and it is very easy to come to whichever is the correct form. I'm just spit-balling things that I think will help newbies.) Calling |
I've been going through the old issues, and it seems there was a similar issue opened 3 years ago: #2844. Should this be closed as a duplicate? |
Yes, duplicate. |
A small lead-in to the ideas proposed by #3914:
As we all know, Nim uses (non-total) case insensitivity for identifier resolution, and I've noticed a lot of people first getting into Nim don't seem to be aware of the important exception involving the first character of an identifier.
will get you the error message
On coming to that error message, it might be helpful if the compiler checks if the normalized identifier validates if the case of the first character is flipped, saying something instead like
(Of course, the idea eventually for the future would be create a list of approximate identifiers, but, you know, baby steps.)
The text was updated successfully, but these errors were encountered: