How do F# units of measure work?

后端 未结 2 497
囚心锁ツ
囚心锁ツ 2020-12-14 09:47

Has anyone had a chance to dig into how F# Units of Measure work? Is it just type-based chicanery, or are there CLR types hiding underneath that could (potentially) be used

2条回答
  •  野趣味
    野趣味 (楼主)
    2020-12-14 10:27

    According to a response on the next related blog post, they are a purely static mechanism in the F# compiler. So there is no CLR representation of the units data.

    Its not entirely clear whether it currently works with non-float types, but from the perspective of the type system it is theoretically possible.

提交回复
热议问题