[Development] Adding support for version number comparisons

Oswald Buddenhagen oswald.buddenhagen at digia.com
Tue May 13 19:13:56 CEST 2014


On Tue, May 13, 2014 at 09:38:03AM -0700, Thiago Macieira wrote:
> Em ter 13 maio 2014, às 18:26:32, Oswald Buddenhagen escreveu:
> > the user has complete control over the input of qversion, and can apply
> > any transformations which his use case may require. also, the effort
> > would be quite trivial (qstring::replace(qregexp())).
> 
> But why should he if we can do it? [...]
>
> If you think the QVersion constructor should be strict, I won't disagree. Then 
> we should have a QVersion::fromUserInput, like the QUrl version, which is lax 
> and has heuristics.
> 
that would work from an api perspective.

but then there is also the semantical perspective. keith's last proposal
i saw considered only numerical segments specially. but some versioning
schemes may treat letters in a numeric way (aa > z). heck, there are
projects which use hexadecimal notation. there is just no way to make an
universal internal representation of that, which means the class' main
purpose (comparing versions) cannot be satisfied.

> The policy isn't in QLibraryInfo: it reflects the policy that was made
> by the Qt Project.
>
the code itself is never the policy. it always reflects some external
decision.

> If we change the policy, we change the class.
> 
we'd need to change the api. it would be an entirely different class.



More information about the Development mailing list