[Development] Should QVariant be doing fuzzy comparisons on doubles?
André Pönitz
apoenitz at t-online.de
Mon Sep 19 21:21:01 CEST 2016
On Mon, Sep 19, 2016 at 11:10:51AM -0700, Thiago Macieira wrote:
> On segunda-feira, 19 de setembro de 2016 19:47:12 PDT André Pönitz wrote:
> > On Mon, Sep 19, 2016 at 09:20:48AM -0700, Thiago Macieira wrote:
> > > This code was there in Qt 5.0, so I kept it when I refactored the numeric
> > > comparisons. Now, dealing with QTBUG-56073, I'm wondering if it should be
> > > there in the first place.
> > >
> > > Should we do fuzzy comparisns in QVariant?
> >
> > No.
>
> Ok, thanks for your and Marc's opinion. I agree with you.
>
> Since this is a P3 and 5.8 hasn't been released, I will push the behaviour
> change to 5.8 and drop the fuzzy comparison.
>
> > QVariant should not expose any numeric or conversion functionality and
> > *only* be used to store and retrieve data. Comparison/Ordering should
> > only be used and only be available to the degree needed to fullfil basic
> > container requirements. Everything else has bitten in the past, and
> > will necessarily continue to do so, and adding more conceptually *wrong*
> > features only digs deeper holes.
>
> That I can't do.
That is understood.
I am not asking to remove existing functionality, just to not to add
"convenience" like
QVariant v1 = char('a');
QVariant v2 = QChar('a');
QVariant v3 = QString("a");
assert(v1 == v2 && v2 == v3 && v1 != v3);
Andre'
More information about the Development
mailing list