Daily Thought - 2024-07-22
< back to listOkay, so what kinds of information can Caterpillar infer, saving the developer from having to write it explicitly? Types are the obvious one, which is what many languages already do. Given a function body, the compiler can infer the function's arguments and return values.
But there's more, like effects. (I'll talk more about effects later. For now, I hope the following example is clear enough.) Imagine looking at a function call, and knowing immediately that it can fail due to divide by zero, that it reads from a specific file, and that it talks to a specific network address.
If the compiler forced you to write those out in every single function signature, that would be very tedious. But if the language is designed for it, effects are easy to infer. And with the right tooling, that information is always at the ready.