Only allowing "." seems a lot simpler.
If we use the locale dependant decimal point when we print numbers,
what should we do when parsing numbers ?
If the parser also uses the locale decimal point, then source code
compiles differently depending on the locale.
If the parser doesn't use the locale decimal point, then number>string
string>number isnt identity anymore.

The solution would be to have 2 different words to parse number in
"canonical source code form" and numbers in "locale dependant form".

Also, the parser currently hardcodes "," as thousands separtor, but
it's also locale dependant...
Jon


On Mon, May 21, 2012 at 5:31 PM, John Benediktsson <mrj...@gmail.com> wrote:
> Perhaps another approach would be to add a check in fix-float for a ","
> similar to the current "." check?
>
> On Sun, May 20, 2012 at 8:24 AM, Jon Harper <jon.harpe...@gmail.com> wrote:
>>
>> Hi list,
>> using a french locale (fr_FR.UTF-8) breaks printing of floats:
>> IN: scratchpad 3.5 .
>> 3,5.0
>>
>> This is because the decimal point in french is ",", so the output of
>> (format-float) is "3,5" and fix-float explicitly checks for "."
>> The locale is forced by gtk to the environnement variables. However,
>> the old X11 backend also forced the locale (in basis/x11/x11.factor)
>> so this is should not be new with the gtk backend..
>>
>> So I guess the best solution is to force LC_NUMERIC to a locale that
>> has a "." as the numeric separator right after gtk_init (for example
>> set_locale LC_NUMERIC "C").
>> Here's a patch that does that: http://paste.factorcode.org/paste?id=2595
>>
>> Please feel free to modify/improve the patch...
>> Jon
>>
>>
>> ------------------------------------------------------------------------------
>> Live Security Virtual Conference
>> Exclusive live event will cover all the ways today's security and
>> threat landscape has changed and how IT managers can respond. Discussions
>> will include endpoint security, mobile security and the latest in malware
>> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
>> _______________________________________________
>> Factor-talk mailing list
>> Factor-talk@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/factor-talk
>
>
>
> ------------------------------------------------------------------------------
> Live Security Virtual Conference
> Exclusive live event will cover all the ways today's security and
> threat landscape has changed and how IT managers can respond. Discussions
> will include endpoint security, mobile security and the latest in malware
> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
> _______________________________________________
> Factor-talk mailing list
> Factor-talk@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/factor-talk
>

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk

Reply via email to