On Fri, Dec 03, 2010 at 12:44:57AM +0100, Pavel Sanda wrote:

> Stephan Witt wrote:
> > There is a patch pending from Georg.
> > I present it here again and propose to apply it.
> > 
> > The second part of the patch is mine.
> > It encapsulates the crucial hasDigit into an ignoreWord() method to
> > prepare to solve the FIXME and to propose an alternate implementation.
> > 
> > The latter is not that important...
> 
> is Enrico fine with the isDigit part? p

It's becoming a mess. We have isdigit(), isDigit(), isDigitASCII(),
and now iswdigit() enters the scene. Too many of those functions,
too much confusion. We should start clearing up things.
I think that isdigit() should be ditched because it only works with
single bytes values.
Looking at the Qt docs, QChar::isDigit() is equivalent to our
isDigitASCII(), so I think that we should also ditch isDigit() in
favor of isDigitASCII().
There's a Qt function, QChar::isNumber(), which tests whether a char
is any kind of number according to the unicode classification. So,
I propose to use this one instead of iswdgit(). It would suffice
changing the isDigit() implementation in lstrings.cpp by simply
s/isDigit()/isNumber()/.

So, IMHO, we should:
1) ban isdigit() [use isDigitASCII() instead]
2) replace all occurrences of isDigit() with isDigitASCII()
3) use QChar::isNumber() instead of iswdigit().

The rationale for 2) would be that isDigitASCII() conveys better
the fact that it is a test for 0..9 only.
As regards 3), iswdigit() may be misleading (is it the same test as
isdigit(), only that one can also pass values higher than 255?), while
isNumber() does not lead to directly thinking to 0..9 only, and anyway
we could name isUnicodeNumber() the function that uses QChar::isNumber()
to make more explicit its meaning.

-- 
Enrico

Reply via email to