News for hackers. Stuff that matters.
Re:Your test suite is trying to tell you something by gizmo686 on Wednesday July 03, 2013 @08:55PM (#5988545)
I think built is support for units is a bit to specific. Support for cheap type alias'es would work, and be far more general. What I mean is something like:

type Inch = int type Centimeter = int

And then have the compiler enforce these as different types (as opposed to alias'es), so if you want to use an Inch, where the function decalares it expects a Centimeter, you would be force to cast it (or have the compiler auto cast using your conversion function).

This doesn't get you support for multidimensional units (IE, define a function that goes from arbitary unit u to u^2), which would require a much more complicated addition to the type system.

Re:Your test suite is trying to tell you something by dragonwriter on Wednesday July 03, 2013 @09:54PM (#5988747)
> I think built is support for units is a bit to specific. Support for cheap type alias'es would work, and be far more general

Go has support for cheap type aliases for which names typed with the same underlying type are distinct types which are not mutually assignable, and, in fact, Duration is such a type with int64 as the underlying type.