On Wednesday, 12 de October de 2011 16:25:18 Pau Garcia i Quiles wrote: > Hi, > > Maybe someone has already proposed this, but just in case: > > In QtCore, have only QRegExp. Maybe rename it to QSimpleRegExp. Simple > regexp support for console-only or GUI-less applications. Should be enough. > > In QtGui, or QtWebKit, or QtDeclarative (I'm not sure which one would be the > best choice), have a new QRegExp using the V8 regexp engine. > > qt4to5 would rename all instances of QRegExp to QSimpleRegExp.
That misses one point: we don't want to keep the current RE engine in QtCore.
It's the third largest file (not counting the generated qunicodetables.cpp and
we discussed moving the date-time parser out of qdatetime.cpp) and QRegExp was
barely ported from Qt 3 to Qt 4 in the first place. It wasn't usable from more
than one thread until Qt 4.4, for example. It doesn't implement any known RE
standard. No one has stepped up for maintaining it, much less adding features
people seem to want (forward look-aheads, for example).
Outside of merges, doc changes and generic maintenance, the last change to
qregexp.cpp was March 1st, 2010 (not 2011). There are a total of 8 such
commits in the Qt 4.x repository (that is, since May 2009) and 4 commits in Qt
5.
What's more, it has a flawed API because it mixes the regular expression itself
with the results of the matching. You can't create a QRegExp object of a
complex RE, hoping to share the pre-compiled internals, and use it from
multiple threads. You need to copy the QRegExp object before matching and hope
that it's smart enough to split the matching from the engine.
And until Qt 4.5, it also had this bad behaviour:
const QRegExp rx(pattern);
if (str.indexOf(rx) != -1) {
/* const rx was modified here!! */
}
We want to move it completely out of QtCore so that QtCore can get a better
replacement in the future. But we also don't want to break too badly the tons
of source code that must be out there using regexp (whether they should be
using regexps or not).
--
Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
Software Architect - Intel Open Source Technology Center
PGP/GPG: 0x6EF45358; fingerprint:
E067 918B B660 DBD1 105C 966C 33F5 F005 6EF4 5358
signature.asc
Description: This is a digitally signed message part.
_______________________________________________ Qt5-feedback mailing list [email protected] http://lists.qt.nokia.com/mailman/listinfo/qt5-feedback
