[Ecls-list] bug with non-english locale and VIM+ECL

Dmitry Petukhov dmgenp at gmail.com
Fri Jun 30 07:55:23 UTC 2006

Hello, I recently tried to use vim+ecl from slim-vim project, and got
vim aborted with

Unrecoverable error:
Lisp initialization error.

After a lot of debugging, i found what problem occurs during
processing of (defconstant imag-one #C(0.0 1.0)) from lsp/numlib.lsp .

parse_number function from c/read.d uses strtod() to parse
floating-point number, and this libc function uses locale-dependent
decimal point. In russian locale it is comma ',' instead of a dot. so
string "0.0" is parsed only until a dot, and parse_number returns 1 in
*ep instead of 3. Then, read_object_with_delimiter sees what length of
string != 1, and decides what this is not a number, but symbol. And
when sharp_C_reader calls  make_complex on resulting cons, we get an
error, because the type of car is not a number.

Strangely, this error does not occur when starting ecl from command
line. Maybe it sets locale to C somewhere ? I didn't find.

Obvious workaround is to set LOCALE=C before working with vim+ecl, but
this is not althogether convenient.

Maybe replacing dots with locale-specific delimiter before using
strtod will be an alternative to implementing floating-point number
parser here. Temporary changing locale may be unwise, because it is
AFAIK global, and can break multi-threaded apps.

More information about the ecl-devel mailing list