On Wed, 1 Feb 2012, Sven Schreiber wrote:
I'm feeling uneasy about the fact that now in some places in
the localized GUI you can enter "2,5", whereas in other
cases you cannot do that (as discussed in this thread). This
causes potential confusion or frustration.
Granted.
So let me have another go at a suggestion for the GUI inputs
(including
function calls, not just pure numbers). The proposal goes as follows:
* Starting point (sic! -- and which I said before): allowing double
meanings for commas in a single expression is out of the question IMHO.
So that means that somebody who uses commas as decimal separators *must*
use something else as function argument separator. I suggest(ed) the
semicolon.
* Needless to say (?), all this does not apply to hansl scripts.
* First solution: Gretl already has a preference option for choosing the
localized decimal separator. (Personally I prefer to work with the '.'
for example.) If that preference is set to localized, it seems logical
to actually _require_ the input in GUI windows in this localized form.
For example under the German (de_DE) locale: "2,5*corr(ser1;ser2)" Note
the semicolon (see above)!
* Extended solution "1b": Gretl could try to be clever and apply a
conversion according to the following algorithm, which tries to maintain
the current behavior where hansl-style input is always allowed:
- Are both a semicolon and a dot present? raise an error
- Is a semicolon present? Then treat it as localized and internally
convert the local decimal separator to dot, and semicolon to comma.
- Is a dot present (irrespective of the presence of a comma)? Then
assume hansl (C-style) rules and do not convert.
- Is only a comma present (and no dot or semicolon)? If the comma is not
inside parentheses, must be a decimal separator, treat everything as
localized. If the comma is inside parentheses, it gets more difficult
and nasty...
But again, given the existing GUI preference option for choosing the
style of the decimal separator, I think there is a strong case for
requiring this chosen style in the GUI, which resolves all ambiguities.
(At the cost of introducing a new character for function argument
separation in the GUI, which would have to be suitably documented.)
A couple of comments on this.
First, I wonder how many users want to see the decimal comma
on output, but would prefer to keep the input in a "genr" box
consistent with hansl?
Second, there's another character that would need fixing,
namely the ';' that is used for terminating a matrix row, as
in
m = {1.1, 2.2 ; 3.3, 4.4}
I suppose this would have to become something like
m = {1,1; 2,2 X 3,3; 4,4}
but what's the 'X'? I guess ':' would be an obvious choice,
but it means things already.
Allin