caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Yamagata Yoriyuki <yoriyuki@mbg.ocn.ne.jp>
To: xavier.leroy@inria.fr
Cc: sjah@land.ru, caml-list@inria.fr
Subject: Re: [Caml-list] string_of_float -> float_of_string locale dependency bug
Date: Tue, 15 Jun 2004 00:23:47 +0900 (JST)	[thread overview]
Message-ID: <20040615.002347.94548124.yoriyuki@mbg.ocn.ne.jp> (raw)
In-Reply-To: <20040614115444.A14769@pauillac.inria.fr>

From: Xavier Leroy <xavier.leroy@inria.fr>
Subject: Re: [Caml-list] string_of_float -> float_of_string locale dependency bug
Date: Mon, 14 Jun 2004 11:54:44 +0200

> The Caml runtime system does depend on the LC_NUMERIC locale begin set
> to its default value "C", but it ensures that this is the case by never
> calling setlocale(LC_ALL, "") nor setlocale(LC_NUMERIC, "").
> 
> Third-party libraries can invalidate this invariant by calling e.g.
> setlocale(LC_ALL, "").  Two possibilities:

Or applications which run ocaml script internally, which become
common recently.

Assuming a particular locale is quite problematic.

> 
> - The library doesn't really need LC_ALL, e.g. it would be enough
>   to set LC_CTYPE or LC_COLLATE and leave LC_NUMERIC unchanged.
>   In this case, the library should be fixed.
> 
> - The library really needs to set LC_NUMERIC, in which case it's
>   impossible to use that library with the Caml toplevel.

Camomile needs to set LC_ALL to acquire LC_NUMERIC value.  Camomile
does not use LC_NUMERIC value currently, but it provides API to
getting all LC_* values for the user.

> The C library API for internationalization is largely broken, and as
> you can see there is nothing we can do to work around the fact that
> the current locale is a global variable for the whole program.

You can temporally save the current LC_NUMERIC value, change its value
to C, and restore the value after the conversion.  What is a problem?

--
Yamagata Yoriyuki

-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners


  parent reply	other threads:[~2004-06-14 15:24 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-06-13 13:30 Evgeny Chukreev
2004-06-13 15:05 ` Yamagata Yoriyuki
2004-06-14  9:54 ` Xavier Leroy
2004-06-14 12:00   ` Evgeny Chukreev
2004-06-14 15:23   ` Yamagata Yoriyuki [this message]
2004-06-14 15:57     ` Evgeny Chukreev
2004-06-14 16:04       ` Xavier Leroy
2004-06-14 16:27         ` Shawn Wagner
2004-06-14 15:58     ` Xavier Leroy
2004-06-14 21:51       ` Yamagata Yoriyuki

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20040615.002347.94548124.yoriyuki@mbg.ocn.ne.jp \
    --to=yoriyuki@mbg.ocn.ne.jp \
    --cc=caml-list@inria.fr \
    --cc=sjah@land.ru \
    --cc=xavier.leroy@inria.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).