[Development] Should QVariant be doing fuzzy comparisons on doubles?

Thiago Macieira thiago.macieira at intel.com
Mon Sep 19 22:18:56 CEST 2016


On segunda-feira, 19 de setembro de 2016 21:21:01 PDT André Pönitz wrote:
> On Mon, Sep 19, 2016 at 11:10:51AM -0700, Thiago Macieira wrote:
> > 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.

https://codereview.qt-project.org/171452

> > > 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);

It may already be too late.

-- 
Thiago Macieira - thiago.macieira (AT) intel.com
  Software Architect - Intel Open Source Technology Center




More information about the Development mailing list