-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Description
It seems to me the promise of the new I/O is that we can write optimal library code that's agnostic of the std.Io implementation. You just express your asynchrony and concurrency requirements in code. That's great for typical client operations, but it's much less clear how a server should work. Right now, there is no "hello world" Zig server like you can easily find for Go or for Rust+Tokio. It would be very cool if std.Io is expressive enough to write an implementation-agnostic server that you'd actually want to use in production. I don't know if it currently is, if that's a goal, or if it's even possible.
I've created a repo here demonstrating 6 different ways I could think of to use std.Io to implement a server: https://github.com/mk12/zig-server. The problem with most of them is they have unbounded memory growth. Some things I'm wondering:
- Is one of those ideal, and the unbounded memory growth is just an stdlib bug?
- Is there another way of doing it I haven't thought of?
- Is the current I/O interface insufficient to express this correctly?
Here are a few other places this has come up: