[Development] Units in QML (was: Re: Scalable UIs in QtQuick (take 2))

Welbourne Edward edward.welbourne at theqtcompany.com
Thu Feb 25 11:20:45 CET 2016


André Somers used m* for minutes and metres, footnoting:
> )* Note the first clash already...

I think it is fairly sane to just insist that SI units take precedence,
especially given that we support multi-letter unit names (e.g. pt, px,
mm, cm), so min will do fine for minutes.

> Numerical values could be implicitly convertable to quantities, but
> not to each other unless such a relation is explicitly defined. That
> should prevent anyone from trying to do 3cm + 4s.

While I agree, I should note that the general case (for a language in
which units are first-class citizens) would need to deal with the fact
that some contexts shall want to deem certain dimensioned quantities as
unities.  In particular, theoretical physicists routinely treat the
speed of light as 1 (not 1 length-unit per time-unit but the pure number
1), identifying lengths and times as being "of the same kind".  At that
point, 3cm is about a tenth of a light nano-second, so 3cm + 4s =
4.0000000001s is perfectly good arithmetic.  I mention this mostly as an
argument against *trying* to deal with the fully general case ...

	Eddy.



More information about the Development mailing list