Lars T. Kyllingstad wrote: > retard wrote: >> Mon, 18 Jan 2010 19:43:54 +0000, BCS wrote: >> >>> It might be a case of NIH, but that doesn't handle fractional units (for >>> example MPa*m^1/2 is used in fracture mechanics and I suspect that they >>> are fairly common as intermediate values in solving equations in odd >>> directions). >> >> You can fix that by encoding the power of each unit as a fraction. No >> big deal. That's a good observation, though. > > He already did. :) > > http://www.dsource.org/projects/scrapple/browser/trunk/units > > -Lars
Alright. One other nit then. What if I want to extend it to add more types of units? I've had occasion to use odd units like "tiles" or "pixels" or "sectors" and things like that when writing games. Then there's money. Also all of the imperial units that I don't care about, as well as the more obscure physical units. I don't expect any of this to come out of the box, but it'd be nice to be able to easily add new types of units by defining what kind of quantity they describe (perhaps as a compile time string) and what the scaling factor is to another known unit (unless it's axiomatic). At any rate I'd love to have guarantee that my units are correct. This kind of stuff has cost me soooo much debugging and frustration in the past.