Corrected manual (Identifier equality) (#6366)

* Corrected manual (Identifier equality)
- Clarified that identifiers are only case insensitive for ASCII characters
- Removed mention of dash-style, since it has been removed
This commit is contained in:
GULPF
2017-09-11 17:31:07 +02:00
committed by Andreas Rumpf
parent c35cc97b1e
commit 9aeb78e2a8

View File

@@ -130,17 +130,17 @@ Two identifiers are considered equal if the following algorithm returns true:
.. code-block:: nim
proc sameIdentifier(a, b: string): bool =
a[0] == b[0] and
a.replace("_", "").toLower == b.replace("_", "").toLower
a.replace("_", "").toLowerAscii == b.replace("_", "").toLowerAscii
That means only the first letters are compared in a case sensitive manner. Other
letters are compared case insensitively and underscores are ignored.
letters are compared case insensitively within the ASCII range and underscores are ignored.
This rather unorthodox way to do identifier comparisons is called
`partial case insensitivity`:idx: and has some advantages over the conventional
case sensitivity:
It allows programmers to mostly use their own preferred
spelling style, be it humpStyle, snake_style or dashstyle and libraries written
spelling style, be it humpStyle or snake_style, and libraries written
by different programmers cannot use incompatible conventions.
A Nim-aware editor or IDE can show the identifiers as preferred.
Another advantage is that it frees the programmer from remembering