Isn't this pretty common? str to int conversions don't commonly support this (quick test: Go, JavaScript, and Python – all throw an error on "str to int −10").
Are there keyboard layouts that have a "minus sign"? I can't find any (standard) keyboard layout that doesn't have - and has − instead (you will need - anyway for lots of contexts).
It’s probably almost entirely IME stuff (I’ve had similar issues with some other dashes in MacOS, with one kind of dash being replaced by a “better” dash, but not the one I was typing, with a Japanese layout)
If an IME doesn't enter a standard hyphen-minus by default, no matter what the language is, that is basically engineering malpractice. How could anyone not know that would fail hard more often than not?
I type Japanese frequently, and hitting the dash/minus key results in "ー" instead of "-". The reason is justified too, namely in that Japanese is almost always typed monospaced so a normal "-" screws up the formatting. The same goes with numbers too, like "3" instead of "3".
I always switch to English input if I need to type in lots of numbers since converting to half-space everytime gets annoying and feeding mono-/full-spaced numbers into text fields usually leads to the program on the backend crapping the water closet.
A dash is definitely not the same as a minus. A hyphen however is so close as to cause a serious ambiguity, so much so that they call the standard character a hyphen minus. So if someone comes along and invents a minus or a hyphen that is distinct from a hyphen minus, and can't even be visually distinguished most of the time, that is not particularly helpful for general use.
People want to use Unicode for everything, when some things are really typesetting abstractions that should be avoided in general purpose computing. Groff and troff have their peculiar exceptions for historical reasons, but surely in retrospect it would have been better for a hyphen minus to render as a hyphen minus rather than as a hyphen.
As far as Japanese goes, the keyboard mapping there is unfortunate. Perhaps they should have considered using a shift key or something to shift between hyphen minus and dash. And in my view those ought to be two characters with typesetting variations, not six or seven.
This is a good joke, but I do remember a course I took that required homework assignments in Mathematica. I definitely copied some of those from the help files. This was down to unimaginative assignments and fairly comprehensive examples in the docs. It even worked in exams, e.g. we were asked to compute and 3d plot a particular Lorenz attractor, this exact problem was in the (available in exam) help files.
It’s a difficult issue. If you write a calculator app as a web page, you might want to use the minus sign for the rendering to look typographically nice. But someone copying the output then might have trouble getting it working when pasting into some number input. A native app of course can convert to hyphen-minus on copying. But really, maybe it should become more common to accept the minus sign for minus in UI input.
Are there keyboard layouts that have a "minus sign"? I can't find any (standard) keyboard layout that doesn't have - and has − instead (you will need - anyway for lots of contexts).