Re:Tour of F#
by pmarreck on Wednesday February 22, 2017 @06:33PM
(#13710287)
Is there a writeup somewhere of this feature?
[ Parent
| on HN ]
Re:Tour of F#
by phillipcarter on Wednesday February 22, 2017 @06:48PM
(#13710368)
There's an article here: https://docs.microsoft.com/en-us/dotnet/articles/fsharp/lang...
That actually looks really indispensable when you're working with units! I wonder if functional langs without this feature might be able to implement it via macros somehow which only run at build time...
Scala has a library for units of measure: http://www.squants.com/
I think you can do it in most reasonable statically-typed languages, with a little care. Scala makes automatic conversions a bit easier because it lets users specify them. Like C# actually. You could probably do UoM in C# too.