2026-09-07 22:45 UTC
The more I work in C, the more I suspect that the "ideal" function signature is:
1. Input args and output args.
2. Return value is success as a boolean.
3. Failure data is an output arg.
This isn't without its own warts, and has plenty of contexts where it isn't appropriate (constant-time eval for example), but it encourages patterns of stack ownership for data, and lets you do:
```
errcode e;
thing1(&e, &x, y) && thing2(&e, &a, b, c) || return err(&caller_err, e);
```
Which really leans into C's strengths as an imperative language, rather than trying to get it to pretend to be something it's not.
Both the #pronelang parser and the new VM stuff are very similar, but not exact, to this mindset. I'm not in any rush to change the function signatures of either, but the parser would probably benefit from this.
Replies (0)
No replies.