This is precisely what gradually typed languages — like TypeScript, Flow, and typed Pythons — solve!
I talked about this on Software Engineering Radio last week: https://www.se-radio.net/2019/10/episode-384-boris-cherny-on....
This is precisely what gradually typed languages — like TypeScript, Flow, and typed Pythons — solve!
I talked about this on Software Engineering Radio last week: https://www.se-radio.net/2019/10/episode-384-boris-cherny-on....
I have heard good a stuff about "gradulizer" though. It uses a gradual type system instead of dialyzers success typing.
Without specs, it will assume every type is 'any()', unless it has information to infer something more stringent. For instance, if it sees you add 5 to it somewhere, it will instead assume it is a number. Etc. Even if in practice it actually is a list of some kind (and so that addition of 5 will fail). Which, yes, ain't great. Hence why I said it was a gradual transition; it will catch provable errors (i.e., if you call append on that same variable as above, it will note that there is no type that allows both append, and + an integer, and error), but leave plenty of things uncaught that could have been caught had it known the type in question (via a type spec).
You have the madness of thousand of developers flinging code at the universe due to the easiness of browsers, JS, and npm.
This results in great speed, but not great quality.
When your project/company now wants quality, you keep your code but transition to types. (In OSS space, Angular and Yarn projects have both done JS => TS migrations of some form.)
> A caller can change sync function to async, breaking the functionality downstream.
I think you mean callee?
Are you taking about using a returned result? Because most languages permit ignoring return values.
If you want to check out promise use, check out https://tsetse.info/must-use-promises
Consider
``` const myIntValue = f(); ```
This code will silently break when f changes from sync to async.
const myIntValue = f()
// Error TS2365: Operator '+' cannot be applied to types 'Promise<number>' and '2'
const myResult = myIntValue + 2
async function f() {
return 42
}