[GSoC Proposal] Statically Checked Measurement Units
Don
nospam at nospam.com
Tue Mar 29 00:06:50 PDT 2011
Cristi Cobzarenco wrote:
> First, let me apologize for this very late entry, it's the end
> of university and it's been a very busy period, I hope you will still
> consider it.
>
> Note this email is best read using a fixed font.
>
> PS: I'm really sorry if this is the wrong mailing list to post and I
> hope you'll forgive me if that's the case.
>
> ======= Google Summer of Code Proposal: Statically Checked Units =======
>
>
> Abstract
> -------------
>
> Measurement units allow to statically check the correctness of
> assignments and expressions at virtually no performance cost and very
> little extra effort. When it comes to physics the advantages are obvious
> – if you try to assign a force a variable measuring distance, you've
> most certainly got a formula wrong somewhere along the way. Also,
> showing a sensor measurement in gallons on a litre display that keeps
> track of the remaining fuel of a plane (a big no-no) is easily avoidable
> with this technique. What this translates is that one more of the many
> hidden assumptions in source code is made visible: units naturally
> complement other contract checking techniques, like assertions,
> invariants and the like. After all the unit that a value is measured in
> is part of the contract.
This is one of those features that gets proposed frequently in multiple
languages. It's a great example for metaprogramming. But, are there
examples of this idea being seriously *used* in production code in ANY
language?
(For example, does anybody actually use Boost.Unit?)
More information about the Digitalmars-d
mailing list