News for hackers. Stuff that matters.
Re:Static checking of units in Servo by portmanteaufu on Monday June 23, 2014 @04:50PM (#7934574)
> Furthermore, the units are used only at compile time. At run time, a Length<Inch, f32> value is stored in memory as just a single f32 floating point value, with no additional data. The units are “phantom types” that are never instantiated and have no run-time behavior.

I love that you get all of this safety with zero runtime cost.

Re:Static checking of units in Servo by dllthomas on Monday June 23, 2014 @10:35PM (#7935924)
This is the difference between types and tags (sometimes they're conflated).
Re:Static checking of units in Servo by illumen on Tuesday June 24, 2014 @08:13AM (#7937255)
This code is buggy because they are using floats internally. A 32bit float can not represent the exact measurements specified.

This is a perfect example of why just statically type checking your code does not make it correct.