On May 30, 8:02 pm, kwikius <a...@servocomm.freeserve.co.uk> wrote:
> On May 30, 10:18 am, James Kanze <james.ka...@gmail.com> wrote:
> > On May 30, 6:00 am, "kwikius" <a...@servocomm.freeserve.co.uk> wrote:
> > > quan
> > >http://tinyurl.com/5lxb3s
> > > std
> > >http://tinyurl.com/6k9b7f
> > > hmm... something smells a bit whiffy ..
> > Sorry, but I don't follow you. What's the relationship
> > between the two?
> The duration type is pretty much of an exact replica of the quan
> quantity.
The duration type is pretty much a simple example of a classical
"units" type. The first time I saw something along those lines
was at least 15 years ago. It's hardly a new idea. (I actually
suspect that it's been "invented" independently many times.)
> From the text the impression one gets is that the design is
> basically that of Jeff Garland boost date time lib, with
> some vague reference to Walter Brown, presumably SI units
> library and implementation by Howard Hinnant.
The actual design did start out with something from Boost. I'm
pretty sure of that. Where the author of Boost got his ideas, I
don't know, but I don't see any reason to think that they come
from some library no one has basically heard of. (The
references in the Boost documentation cite some 10 or 15
different libraries. Presumably if quan had played a role, it
would be cited there as well.)
> I believe Walter Brown used compile time rational numbers [1]
> in SIUnits, as did Barton & Nackman, but they only used
> compile time rationals for dimensional analysis, not
> conversion factors (meter to millimeters etc).
As I said, I have been aware of this possibility for at least 15
years. And while I don't know of its relationship with Walter's
SIUnits, I do know that a class with this name was available
publicly over ten years ago. (But Walter could just as easily
have come up with the same thing---and the name is rather
obvious.)
> The original use of compile time rationals for the units was
> AFAIK my pqs library, the forerunner of my quan library in the
> above link. (Originally pqs used 2 separate compile time
> integers, but it was Brandon Forehand that pointed out that
> they were in fact acting as a rational number, and pqs was
> subsequently modified accordingly).
I'm not too sure what you mean by "compile time rationals", but
libraries which would support assigning meters to millimeters,
for example, with automatic scaling, are not particularly new.
> In fact Mr Garland did use conversion factors in his boost
> date time lib, but used runtime scaling (in an explicit ctor
> at least in boost_1.33.0), all values were kept internally in
> milliseconds in a base class.
I've seen both techniques, both many years ago. I think both
date back to the early days of Algol.
--
James Kanze (GABI Software) email:
Conseils en informatique orientée objet/
Beratung in objektorientierter Datenverarbeitung
9 place Sémard, 78210 St.-Cyr-l'École, France, +33 (0)1 30 23 00 34