lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

> This means was suprising to me and has a number of consequences:
>   - Using a seperator such as "," is impossible in the first place as:
> [...]

Using a separator such as "," is impossible in the first place because
print(1,0) already has a meaning in Lua. It would a be a big mess if
the lexer respected locales, and the mess has nothing to do with the

>   - If running in a locale where '.' is not the decimal separator,
> parsing lua could result in *many* calls to `localeconv`.

I am not sure what you count as "many", but the code seems to call
`localeconv` once per chunk (unless you change locales during
parsing, in which case is plus one per change).

> Fixing lua_str2number to be locale independent will:
>   - allow the `trydecpoint` hack to be removed from llex.c
>   - fix tonumber() to *not* be locale dependant.

One is false; as you said, we would have to fall back to it in C89.

Two is dubious; this "fix" may affect people that count on this

Couldn't your library change the locale whean reading numbers and
then convert it back to what it was when done?

-- Roberto