One of my favorite things is that libghostty really forces us to better our core. For example, we recently made stream processing infallible (sending arbitrary user input into Ghostty). External input can't be trusted, so it must never cause our core to fail. Now it doesn't.

Zig's error system makes this easy and obvious. Previously, errors would bubble up from handlers through to the stream processor. The practical effect is that if a sequence failed, it could cause partial processing of terminal sequences. I never heard of this happening in practice, but the API allowed it.

Now, we force all error handling to happen at the handler level. If an error happens, the handler must deal with it and guarantee that the terminal is in a coherent state. The stream processor WILL move forward.

This was critical because when designing the C API, we needed to determine what possible errors could be returned from `ghostty_terminal_vt_write`. On reflection of the Zig API, I realized... none can. No possible errors can (or should) occur. I was able to fix this through the type system in Zig and now the C API is a `void` return type with zero allocation. Hurrah!

PR: github.com/ghostty-org/ghostty

0

If you have a fediverse account, you can quote this note from your own instance. Search https://hachyderm.io/users/mitchellh/statuses/116229998376761218 on your instance and quote it. (Note that quoting is not supported in Mastodon.)