Hacker News new | ask | show | jobs
by amw-zero 1073 days ago
That doesn’t seem like a fair characterization in all cases.
1 comments

It's a fair characterization because it's a common enough issue to become a problem. It's a compounding of several issues, really, of which "types are documentation" is just one:

- types are not documentation

- tests are not documentation

- code is not documentation

What would you call the ability of a type to communicate information such as the range of values that can be passed into a function?
I'd call it exactly that.

Note that there are very few languages that have those kinds of types. Usually it's enums and union types that usually tell you nothing about where to get those ranges, why those ranges exactly, or what those ranges mean.

Literally right now I'm looking at a GraphQL schema that tells me that for a collection of lists of data it returns the following list types: Generic, GenericV2, Onboarding, OnboardingActive... That's it. Actual call returns only a few of those with no apparent difference in actual data.

It is typed though.

Can you look at which fields are required to make a value of type `Generic`, `GenericV2`, etc.?