Hacker News Viewer

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&#x2F;if blocks, which I don&#x27;t quite get).<p><a href="https:&#x2F;&#x2F;github.com&#x2F;solod-dev&#x2F;solod&#x2F;blob&#x2F;main&#x2F;doc&#x2F;spec.md#defer" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;solod-dev&#x2F;solod&#x2F;blob&#x2F;main&#x2F;doc&#x2F;spec.md#def...</a>

4/7/2026, 3:35:44 AM


by: Retr0id

I don&#x27;t really &quot;get&quot; the sweet-spot being targeted here. You don&#x27;t get channels, goroutines, or gc, so aside from syntax and spatial memory safety you&#x27;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&#x27;s the temporal safety that worries me most, in nontrivial C codebases.

4/7/2026, 2:06:52 AM


by: tidwall

&quot;To keep things simple, there are no channels, goroutines, closures, or generics.&quot;<p>I wonder if it could be integrated with <a href="https:&#x2F;&#x2F;github.com&#x2F;tidwall&#x2F;neco" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;tidwall&#x2F;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:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=47627595">https:&#x2F;&#x2F;news.ycombinator.com&#x2F;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:&#x2F;&#x2F;codapi.org&#x2F;" rel="nofollow">https:&#x2F;&#x2F;codapi.org&#x2F;</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