-
-
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
Compiler warning on mismatching case/spelling #15848
Comments
Well when defined(nimHasStyleChecks):
{.push styleChecks: off.}
# code here
when defined(nimHasStyleChecks):
{.pop.} # {.push styleChecks: off.} What else do you need? |
the style check is slightly different - it checks that symbols adhere to NEP-1 - ie that variables use the right capitalization etc - but for various reasons, we might be using a different style for some symbols, and what we need is that the compiler only checks that usage matches the declaration. |
Ah ok. |
narimiran
pushed a commit
that referenced
this issue
May 14, 2021
narimiran
pushed a commit
that referenced
this issue
May 17, 2021
PMunch
pushed a commit
to PMunch/Nim
that referenced
this issue
Mar 28, 2022
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Nim allows identifiers that differ in
cAse
andsp_ell_ing
- however, the spelling used in the declaration can be considered canonical.For security-critical code, the introduction of alternate spellings can lead to vulnerabilities code injection (specially considering name clashes in larger project), and makes it harder to audit the code using tooling that is unaware of the naming, and generally creates confusion for developers reading the code.
As such, we would benefit from a compiler flag that, similar to
--styleCheck
, emits a warning when an alternate spelling is used, along with an option to disable it per-module, per-symbol or per-use (via pragmas?)The text was updated successfully, but these errors were encountered: