Daily Thought - 2024-12-07
< back to listEffects in Caterpillar happen under the hood. They are implemented in the runtime, and the compiler knows about them, but they are not a part of the language. They are an implementation detail. But that could change.
At a minimum, it would be possible to annotate functions with the effects they could have. So if a function calls a host function that triggers a "write file" effect, for example, then the function could be annotated as having that effect. And any function that calls it (and any function that calls that function, recursively), would be annotated with that effect too.
Then you could look at a part of your program (or your main
function, if you
want to look at your program as a whole) and see what kinds of I/O it could
potentially do, and what kinds of errors it could potentially trigger. But by
itself, this is of dubious value, as I intend to explain tomorrow.
Hey, you! Want to subscribe to my daily thoughts? Just let me know (maybe include a nice message, if you're up for it), and I'll send you an email whenever I post a new one.