Solod – A Subset of Go That Translates to C
by TheWiggles on 4/7/2026, 12:48:01 AM
https://github.com/solod-dev/solod
Comments
by: ridiculous_fish
I was curious how defer is implemented. `defer` in Go is famously function-scoped, not lexically-scoped. This means that the number of actively-deferred statements is unbounded, which implies heap allocation.<p>The answer is that Solod breaks with Go semantics here: it just makes defer block-scoped (and unavailable in for/if blocks, which I don't quite get).<p><a href="https://github.com/solod-dev/solod/blob/main/doc/spec.md#defer" rel="nofollow">https://github.com/solod-dev/solod/blob/main/doc/spec.md#def...</a>
4/7/2026, 3:35:44 AM
by: Retr0id
I don't really "get" the sweet-spot being targeted here. You don't get channels, goroutines, or gc, so aside from syntax and spatial memory safety you're not really inheriting much from Go. There is also no pathway to integrate with existing Go libraries.<p>Spatial memory safety <i>is</i> nice but it's the temporal safety that worries me most, in nontrivial C codebases.
4/7/2026, 2:06:52 AM
by: tidwall
"To keep things simple, there are no channels, goroutines, closures, or generics."<p>I wonder if it could be integrated with <a href="https://github.com/tidwall/neco" rel="nofollow">https://github.com/tidwall/neco</a>, which has Go-like coroutines, channels, and synchronization methods.
4/7/2026, 2:08:36 AM
by: MYEUHD
Related and currently on the front page: <a href="https://news.ycombinator.com/item?id=47627595">https://news.ycombinator.com/item?id=47627595</a>
4/7/2026, 2:25:02 AM
by: remywang
Anton also wrote the fantastic codapi [1] for embedding executable code snippets with wasm<p>[1]: <a href="https://codapi.org/" rel="nofollow">https://codapi.org/</a>
4/7/2026, 3:14:17 AM
by: Onavo
Does it work with the preprocessor?
4/7/2026, 2:38:35 AM
by: MegagramEnjoyer
This is a bit too barebones. At least bring goroutines dude
4/7/2026, 3:10:39 AM