3 ms·
Which language did you use to encode these types?
by justsomeuser 5y ago
Which language did you use to encode these types?
- tluyben2 5y agoWe work in C# mainly; unfortunately; I have been in favour of F# for a long time, but it's just not popular enough so it would make our (already large, with decades of work) codebase less maintainable. However it does not really matter as long as you can make the types (classes in the case of C#) precise enough. You can indeed (see the other commenter) make (an) Age classe(s) which will give a nice error message if you do something illegal, for instance; int i = -2; Console.WriteLine((Age)i); Console.WriteLine((Age)200); Console.WriteLine((AdultAge<UnitedStates>)17); will throw three Exceptions. We define every single piece of data like that.