News for hackers. Stuff that matters.
Re:Please put units in names by ReleaseCandidat on Monday March 21, 2022 @05:56AM (#30752170)
I _really_, _really_ like F#'s 'unit of measure': https://docs.microsoft.com/en-us/dotnet/fsharp/language-refe...
Re:Please put units in names by fluid_ident on Monday March 21, 2022 @09:49AM (#30754087)
This. I really miss it when working outside of F#. I work on scientific code bases with a lot of different units and have been burned by improper conversions. Even with a high automated test coverage and good naming practices, such problems can go undetected.
Re:Please put units in names by ok123456 on Monday March 21, 2022 @10:14AM (#30754373)
It's a big omission that it doesn't support fractional units. These come up in things like fracture mechanics for stress intensity.
Re:Please put units in names by ReleaseCandidat on Monday March 21, 2022 @10:25AM (#30754494)
Are you talking about ksi√in or MPa√m? That is not a problem.
Re:Please put units in names by ok123456 on Monday March 21, 2022 @02:26PM (#30757809)
F#'s units don't support 1/2 dimensions. So you can't do dimensional analysis through the type system.