On 02/18/2015 11:21 PM, Rick Widmer wrote:
> On 2/18/2015 7:44 PM, Rasmus Lerdorf wrote:
>> Now if we went into Unicode territory, we could do it. eg.
>>
>>    my_func(1 999 999) U+1680 (although it looks too much like a -)
>>    my_func(1 999 999) U+205F (mathematical space)
>>    my_func(1٬999٬999) U+066C (Arabic thousands separator)
>>    my_func(1·999·999) U+00B7 (middle dot)
>>
>> The last one looks best to me, but we'd need a team of people working in
>> shifts to answer the, "How do I type this?" question.
>>
>> -Rasmus
> 
> how about:
> 
> my_func( '1,000.04' );   //if you want to use separators there.

The problem with that is that the world is split. The other half, or
actually more than half, would write that as '1.000,04'. There is no way
we would want to take sides on that one. And we have support for
locale-based number formatting and parsing via numfmt_format() and
numfmt_parse(). If we were going to add a separator for literals, the
only real low-ascii choice is _ which is also used by Ada, D, Java, Perl
and Ruby.

I was 90% kidding about using a Unicode character, but if you think
about it a bit, most people are using IDEs or at least smart scriptable
editors, it wouldn't be that much of a stretch to picture your editor
pretty-printing 1234567890 as 1·234·567·890 or 1˙234˙567˙890 (U+02D9).
It would be easy to make the parser ignore that character in numeric
literals. Much easier than working out the various issues with _ anyway.

Although, personally it would freak me out if my editor started messing
with my numbers on me. But I don't use an IDE. I don't even have
syntax-highlighting turned on in my vim config. We didn't have stuff
like that on the Wyse 50.

-Rasmus

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to