Open
Description
You can say the following about the character currently exclusively recognized as minus by FromStr
impls:
- Its official Unicode name is
U+002D HYPHEN-MINUS : hyphen, dash, minus sign
(copied from BabelMap). - The general typographical reality of font designs is that it's a hyphen and not a minus sign.
- The usage-wise reality is that it's widely used as a replacement character for a real minus sign.
In comparison, U+2212 is a dedicated minus sign:
- Official Unicode name:
U+2212 MINUS SIGN
- Matches the horizontal bar of a plus sign.
- GitHub, e.g., uses it to display the red "lines deleted" values. Wikipedia and LaTeX equation renderings also use it.
- In HTML, you have the entity
−
for it.
Benefits of adding support:
- If the
FromStr
implementations of number types (i32
,f64
etc.) would supportU+2212 MINUS SIGN
in addition toU+002D HYPHEN-MINUS
as a minus sign, UI frameworks, e.g., would have an easier time implementing text boxes that display the typographically more pleasing real minus sign, simply converting the text content to the corresponding number. - App implementations not further checking user input, but directly trying to parse it as a number, and banking on the returned
Result
, wouldn't confuse end users anymore when they pasted a number with Unicode minus into the app and the app showed an error. - Also, since it's a dedicated minus sign, and not just a common replacement character, it logically follows in my opinion that it should be supported.
I'm not familiar with this, but I want to point out that the Wikipedia article "Plus and minus signs" also talks about ⁒ as a minus sign (U+2052 COMMERCIAL MINUS SIGN
). Perhaps, this should also be supported. But I don't know whether it's regularly set off from the number with some space character.