Re:Resources about programming practices for writing safety-...
by spc476 on Monday March 06, 2017 @10:59PM
(#13808162)
A simple example would be instead of this:
or even:
you would have:
And an assignment between a and b would be an error, as Celcius and Fahrenheit are different types. Going along this path then, if you can extend the type system enough:
Think of the type of calculations that the Unix command 'units' does, but built into a language instead of an application.
[ Parent
| on HN ]
Re:Resources about programming practices for writing safety-...
by dkersten on Tuesday March 07, 2017 @08:48AM
(#13810241)
The Frink[1] language has units like this built in. Its pretty cool what you can do with it. I definitely agree that doing that or, at least, something like your code samples, is a good bug-avoidance idea.