First of all, thanks for starting a new thread :-)
Mark Greenaway wrote:
> I was wondering if anyone was aware of a standard approach
> developing numeric types that include their units, or other information
> relevant to them.
What you are looking for is called "dimensional analysis".
<snip>
> I'm sure I'm not the first person to have thought of this.
You aren't :-).
> Has anyone seen or used data types that use these sorts of ideas?
I know there are some C++ template metaprograming hacks that allow
for this sort of stuff to be checked at compile time. For instance
in the Boost libraries:
http://www.boost.org/libs/mpl/doc/tutorial/dimensional-analysis.html
I am also aware of this being available as a library/module for
Haskell. I'm not sure if anyone has done it for Ocaml, but I'd
love to see it if you find it. I also think the Haskell version
would be pretty easy to port to Ocaml.
HTH,
Erik
--
+-----------------------------------------------------------+
Erik de Castro Lopo
+-----------------------------------------------------------+
Learning Linux is like joining a cult. Sure it's fun at first but
you waste time, become brainwashed, and then have to be de-programmed
by Bill Gates before you can work for Him again.
- Ray Lopez, in [EMAIL PROTECTED]
_______________________________________________
coders mailing list
[email protected]
http://lists.slug.org.au/listinfo/coders