5 ms·
> The decision if an integer is stored as a 4 byte or 8 byte, big-endian or little-endian, should be up to the computer to decide. What about the decision whet
by adwn 5y ago
> The decision if an integer is stored as a 4 byte or 8 byte, big-endian or little-endian, should be up to the computer to decide.
What about the decision whether a function argument is an integer or a string? A floating-point value or an optional floating-point value? How could the compiler ever decide that?
The size of an integer is only a very, very small part of a modern static type system.
- belorn 5y agoFrom a system and integration tests perspective, do you care if a function argument is an integer or a string? Is the question relevant to the customer requirements? If a number is an int, float, large or what have you, the question I would ask is how many decimal points should be printed or if you divide 2 with 2, do you get 1 or 0.99999. A good language/compile should have sane defaults that works almost every time, while giving me options to override it if in testing it get an unexpected result where a human would disagree with the computer. The source of tests should be the customer requirements, and types is just an set of automatic tests being applied on the code which has no direct connection to the customer requirements.
- adwn 5y agoWat. I have no idea what you're going on about. The customer doesn't care about the particulars of your unit or integration tests, instead they care about whether your software works properly. A modern, powerful static type system is one tool that helps a developer achieve that goal of properly working software, and the developer absolutely should care about whether that function argument is an integer or a string.