3 ms·
Of course it should be a api but it should be either explicitly requiring a format OR (more likely) default to an invariant format. That is, if I do this
by alkonaut 5y ago
Of course it should be a api but it should be either explicitly requiring a format OR (more likely) default to an invariant format.
That is, if I do this
float f = 123.456;
Console.WriteLine(“value is “+f);
The output shouldn’t vary depending on whether it’s run in France or the US (which it does by default).
For parsing, the argument should even be explicitly required I think. So
float f = Float.Parse(“1,23”, frenchLocale);
So that it’s not ever forgotten or the reader has to wonder if the author forgot it.
- olliej 5y agoJavaScript’s numeric parsing is locale independent. People write too much code blindly to make any kind of locale inference anywhere. Otherwise I agree with you whole heartedly - I have been stung by absurd locale dependent behaviour in the past (windows’ font loading APIs inexplicably translate the font variant in the programmatic api)