Mon, 05 Oct 2009 11:41:52 +0000, language_fan wrote: > Mon, 05 Oct 2009 05:29:20 -0600, Rainer Deyke thusly wrote: > >> bearophile wrote: >>> Scala has a powerful type system that allows to implement such things >>> in a good enough way: >>> >>> http://www.michaelnygard.com/blog/2009/05/ > units_of_measure_in_scala.html >> >> Either I'm missing something, or this system only checks units at >> runtime (which would make it both slow and unsafe). >> >> Boost.Units (C++) checks units at compile time. There is no reason why >> D could not use the same approach. > > There have been several existing implementations of SI unit libraries > for D. By Oskar Linde et al. The checking can be built statically > without any runtime performance penalty.
The only problem with these was that there was no way to signal the location of the type error in the client code, it always reported the location of the (static) assert in the library, which is pretty much useless.
