How do F # units work?

Does anyone have a chance to delve into how F # Units of Measure works? Is it just a type-based ticking or are there hidden CLR types that can (potentially) be used from other .net languages? Will it work for any numeric unit or is it limited to floating point values ​​(which all examples use)?

+14
units-of-measurement functional-programming f #
02 Sep '08 at 22:37
source share
2 answers

According to the answer on the next related blog, they are a purely static mechanism in the F # compiler. Therefore, there are no CLR data units.

It is not entirely clear whether it currently works with non-fusible types, but from the point of view of the type system this is theoretically possible.

+11
Sep 02 '08 at 23:12
source share

The best (and, I think, official) place to find out about this is Andrew Kennedy's blog.

Here are the (relevant) relevant posts.

As I said in the post your defendant was talking about, this is definitely something you CANNOT do in C # (although I would like you to be able to).

+15
Sep 17 '08 at 9:31
source share



All Articles