5 ms·
I wish Zig had Go-like interfaces. I understand why they don't as they have decided control flow must be explicit but having to include a heap of boilerplate to
by shirro 3y ago
I wish Zig had Go-like interfaces. I understand why they don't as they have decided control flow must be explicit but having to include a heap of boilerplate to get the same result isn't a win for readability or maintenance. Given my limitations and tastes I would not want to write or maintain web backend code in Zig but there is a lot to like about Zig as a C replacement and having batteries included for things like HTTP is a win for any language.
- jonahx 3y ago> I wish Zig had Go-like interfaces. I understand why they don't as they have decided control flow must be explicit How do Go-like interfaces make control flow non-explicit?
- philosopher1234 3y agoprobably referring to the dynamic dispatch
- dvt 3y ago> having batteries included for things like HTTP is a win for any language I actually kind of disagree with this. I was a super early Go contributor and helped a tiny bit on the HTTP library (back then it was the core `http` package, now it's under `net/http`). Imo, a lot of HTTP stuff tends to be very "grey area" (what are sensible timeouts? how do you handle different socket errors? should we allow self-signed certificates?) so a lot of opinionated design debate ends up happening, and there's also a lot of scope creep, including having to include things like SSL/proxying if you really want "batteries" to be included which is a lot of non-trivial work (all of a sudden, you also need a elliptic curve cryptography lib, too) that basically has nothing to do with the language itself. I know we live in an "HTTP world" and it's a lot easier to sell a language that can also do stuff on the web, but it would be pretty far down my list.
- candrewlee14 3y agoAgreed about Go-like interfaces. I don’t think it’d fit Zig to make them dynamic at runtime the way Go does, but even just as a compile-time constraint it would make building a composable ecosystem like Go’s much easier. See writer: anytype.
- Tozen 3y agoThere have been many arguments that Zig's Try/Catch is hidden control flow. Though many would argue that trying to stick to "catch phrases", can result in painting one's self into a corner, versus what's best to accomplish a task. Lots of people love interfaces (or similar like "traits"). Helps them get what they need done and there are lots of examples of their usage in different languages. Accomplishing the task, is what's most important.