Daily Thought - 2024-08-26
< back to listThere's one assumption in yesterday's thought that I'd like to call out: The easy fix for determining the active expression in a reconstructed stack frame depends on functions having exactly one exit point. If you allow early returns, then functions can have multiple of those, and suddenly this is no longer possible.
I use early returns in Rust, but discovered that they are more controversial than I thought. Many seem to favor coding styles that avoid them completely, claiming it will lead to cleaner code. Even before I came across call stack reconstruction, I had decided I wanted to try that style in Caterpillar. Now it turns out, this is critical for supporting this important feature.
This leads into a larger theme: Restricting what the language can do, making it more simple as a result, can make it easier to understand. By the developer, hopefully, but also by tooling (which then benefits the developer indirectly). This is something that I want to explore in the design of Caterpillar. The result will be unfamiliar to many, but I hope lead to a better experience.