HACKER Q&A
📣 hot_gril

Creating a language/runtime for fun, is this idea dumb or not


I was thinking of writing a language/runtime on top of Golang for fun and self-education. It'd be interpreted and use an event loop, sorta like JS except with opposite defaults: every function is async unless otherwise marked sync. A lot of built-in stuff like math would be sync, and it'd warn you if the event loop is spinning very fast (meaning you should probably paint more stuff as sync).

No strong reason for using Golang other than it's the one sorta popular language I've never used, so I'd get to learn it.

But I don't want to do a project that's pointless even in theory. For applications with lots of blocking I/O, I feel like an event loop can be more efficient than Golang greenthreading. Does anyone want to talk me into or out of this?


  👤 whatamidoingyo Accepted Answer ✓
Dumb idea? No way. Actually, I'm currently reading Crafting Interpreters which is exactly this. It's free to read online, if you wanted to check it out: https://www.craftinginterpreters.com/

Super fun book.


👤 RetroTechie
If you're aiming to create some kind of 'product', then... dunno, your time may be better spent elsewhere.

But if "for fun and self-education", then it is not pointless, right? Go ahead!


👤 gitgud
> every function is async unless otherwise marked sync

Very interesting, I’ve never heard of a language doing that.

I say go for it, it won’t be pointless or dumb and at the very least you’ll learn a tonne about language design!


👤 binkethy
Why seek the approval of others before embarking upon a journey of educational discovery?

I guarantee you that you will only be capable of fully appreciating the entire general area you are speaking of AFTER attempting some such project in that space.

Wasted effort doesn't exist, nor will you likely take advantage of initial ideas or code.


👤 mikewarot
Fun doesn't need justification. You'll always learn things as the constraints add up and you have to get around them.

👤 mac3n
you'll have to think carefully about sharing and communication among your asyncs