Add new Measure type to ease UoM conversions#17518
Conversation
❗ Release notes required
|
|
Few questions:
I think before the implementation we need to start with RFC, and once that is approved and discussed, we can proceed with implementation |
|
|
I think we should still start with rfc for it, so everyone agrees on specifics. |
|
I put together a draft RFC here fsharp/fslang-design#784 is there something else I missed? |
That looks like a good start, now we need some comments on it. I'll probably be also good to have all types next to examples so people get a good understanding how many methods/functions are added |
|
@roboz0r : We have dicussed this addition and have an idea on how to bring the same functionality with a new compiler intrinsic, instead of adding many new functions to FSharp.Core. This would especially mean a lot smaller size footprint. |
|
(coverting to draft due to the suggestions above) |
ae834a8 to
b3ed399
Compare
Description
Creates a new
Unitstype to meet some of the goals in fsharp/fslang-suggestions#892The type adds
Units.Add,Units.Remove, andUnits.Castmethods for supported primitive types to simplify UoM conversions. It also addsUnits.Add*,Units.Remove*, andUnits.Cast*e.g.Units.AddArrayto perform UoM conversions on common collection types without allocations.I haven't added any tests as the code doesn't actually do anything, it's just a wrapper over
retype. Happy to add anything you think would be helpful.Checklist