From: Hans Aberg (firstname.lastname@example.org)
Date: Wed Mar 09 2011 - 10:51:46 CST
On 9 Mar 2011, at 16:24, Philippe Verdy wrote:
> No such ambiguity : List separators, if they use a comma, should
> follow it by a space.
> So "1,2" is unambiguously NOT a list of two numbers, but a single
> number; "1, 2" is interpreted exactly the reverse way.
Yes, but for example the Haskell interactive compiler GHCi and interpreter Hugs write lists without a comma. So if one gets used to that, it may produce a nasty surprise.
Examples like these are called "gotchas", that is, even though it work as documented, it is contrary to human expectation.
> In technical papers or articles or user guides, intended to be read by
> humans, the locale used in the document will apply simultaneously to
> number formats and list formats.
> But within locales that use the comma as a decimal separator,
> preferably use the semi-colon as the list separator for technical data
> files (for example, CSV files saved and parsed by the French
> localization of Excel, with the defautl settings), because the space
> is ignored and used instead as optional padding. For such technical
> data files, the comma should never be used as a value separator in
> lists (other commonly used list separators are the pipe character (|)
> and the colon in many Unix settings files)
These days, one cannot expect a single, consistent use. Whence declaration the 2003 by the 22nd General Conference on Weights and Measures.
> No ambiguity also within most programming languages (because numeric
> constants are not localizable and use a single syntax, and list of
> values are used for lots of things and almost always use the comma,
> for example in function/method parameters, initializers, declarators,
> 2011/3/9 Hans Aberg <email@example.com>:
>> On 9 Mar 2011, at 12:56, André Szabolcs Szelp wrote:
>>>> Dots are also used for IPv4, but it becomes ambiguous if one needs a fractional part.
>>> Oh, quite a lot of people use "," for fractional parts...
>> The 22nd General Conference on Weights and Measures (2003) declared to use either a "." or a "," (see page below, section "History", last paragraph). Admitting both though creates an ambiguity of 1,2 interpreted as a list of two numbers 1, 2 or a single number 1.2.
This archive was generated by hypermail 2.1.5 : Wed Mar 09 2011 - 10:54:28 CST