|
On 26-Jan-07, at 2:33 AM, Glenn Maynard wrote:
This is really an effect of C's awful localization API--there should be a way to get a handle to a locale set, and alternate functions forsscanf, printf, strtod, etc. that take a handle as an additional parameter.
That is just so true. It's astoundingly bad design. The extra parameter would make life so much easier.
I don't think that setting the numeric locale is a good idea in general. But Lua's parser still works. It has an explicit workaround for parsing floating-point numbers in non-standard locales.The behavior is perhaps unexpected and poorly thought out, from an API standpoint, but it is not, as far as I know, nonstandard.
I think by "non-standard" he meant "other than the C locale" as opposed to "not conforming to the standards".
In the case of the numeric locale, Lua buries the ugly hack inside its own lexer, which seems appropriate. But changing locales can also change the definitions of character classes, which can also affect the lexer (as well as pattern matching inside user programs).