3 ms·
This is neat stuff, and I've looked into it before. One question I have, though, is regarding interoperability with C#. If I have a units library that is in F#
by RobotCaleb 12y ago
This is neat stuff, and I've looked into it before. One question I have, though, is regarding interoperability with C#. If I have a units library that is in F# using what's shown in OP, would I be able to use the UoM in C#, or would I have to revert to unitless values on the C# side of the interface?
- RobotCaleb 12y agoA little bit of searching shows that this is entirely in the compiler and the CLR never sees it. I did find an exploration of this topic at https://stackoverflow.com/questions/348853/units-of-measure-in-c-sharp-almost https://stackoverflow.com/questions/348853/units-of-measure-...
- ghuntley 12y agoFrom the article @ "Units of Measure at runtime and interoperability ": One key point to take heed of, is that units of measure do not exist at runtime. They are intended for static type checking only and therefore prevent us implementing functionality based on checking units. They are also not part of the wider .NET type system and can therefore not be consumed, or used, by any non F# assembly. If exposing units of measure to consumers, the units are simply not visible and all values will be treated as there underlying, dimensionless type.
- M8 12y agoYes, that's the biggest problem with them.