lua-users home
lua-l archive

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


On 2010-09-08, Alexander Gladysh <agladysh@gmail.com> wrote:
> On Wed, Sep 8, 2010 at 16:50, Leo Razoumov <slonik.az@gmail.com> wrote:
>  > On Tue, Sep 7, 2010 at 05:43, steve donovan <steve.j.donovan@gmail.com> wrote:
>  >> On Tue, Sep 7, 2010 at 11:35 AM, Mike Pall <mikelu-1009@mike.de> wrote:
>  >>>> 123,456,789.554433
>
>  >>> Nope, since strtod() doesn't handle that (in most locales).
>
>  >> It would also be ambiguous - e.g return 123,233.2  - Lua syntax
>  >> interprets this as returning two values.
>
>  > By this logic even 123,456 is ambiguous in a locale that uses "," as a
>  > decimal separator.
>  > Looks like a can of worms:-)
>
>
> Oops! My serialization code will generate ambigious output then? No, thanks!
>
>  Programming language syntax should not be dependent on the locale.
>  Implementation problems are a poor excuse...
>
>
>  Alexander.
>

Yes, indeed. Why create a problem when none exists.  A language should
have number formats cast in stone once and for all. For example,
accepting only "." as a decimal separator, only "-" for negative
numbers, etc. If a user-input facing API has to be locale specific, an
explicit adapter function should be used to translate strings as
needed.

--Leo--