Comment by drdaeman

1 month ago

If you don’t specify types explicitly they have to still exist somewhere: in someone’s head (in oral tradition of “Ah, yea, those IDs are UUIDs, but not those - those are integers”), or denoted through some customary syntax (be it something more formal like Hungarian notation, or less so - suggestive suffixes, comments, supplementary documents).

They still exist at runtime, and people who work on the codebase need to somehow know what to expect. Having a uniform syntax helps to formalize this knowledge and make it machine understandable so it can assist developers by providing quick hits and preventing mixups automatically (saving attention/time for other matters).

Types may be rarely important for local variables, but they matter for API contracts.

> people who work on the codebase need to somehow know what to expect.

IME this is the exception more than the rule. There will be a ton of manipulations where I don't really care what the types are, just whether I can do the specific thing I want on them.

For instance you receive the data from an API and want to pass it to the appropriate validator. The type definitions are noise, and checking them is the validator's job.

Now it's nice to be able to work with stricter types where needed, ideally I'd want to switch that on and off, instead of being stuck with them everywhere.