6 ms·
One thing that I’m quite bummed out with Zig is the lack of a good http server/client implementation in the standard library. Golang’s std implementation on thi
by koeng 5y ago
One thing that I’m quite bummed out with Zig is the lack of a good http server/client implementation in the standard library. Golang’s std implementation on this is really quite nice.
- throwaway17_17 5y agoDo you feel like http server/client is ‘mandatory’ in a standard library in 2021? I don’t really do any web adjacent programming so it’s not something I ever think about. However, I know I am in a very small group of people who don’t have to worry about web stuff. I’ve been toying with a release of the personal language I use and was just rolling around the idea of what to put in the ‘standard’ library if I do release it. Anything else you think has to be in a std library?
- lostcolony 5y agoIt's very much a nice to have for a new language nowadays, as even if web dev isn't the key niche of the language, any success the language has is likely to still include a need for it. Adding it also creates interfaces and conventions that any third party ones can choose to adopt, to ensure it's a drop in replacement (and even if they don't fully, they'll likely still follow the same paradigm). This is really beneficial as, while the stdlib's version may be very middling, it ensures adopting the language and a third party's http implementation isn't going to trap you into something that becomes unmaintained, and which doesn't have a clean migration path away from; you can always fall back to using the stdlib's http library, since there's an expectation it will be maintained along with the language. That said, if you're putting your language up as a "see the neat thing I did that's helpful in this very specific domain", and not general purpose, with the intent of supporting, it's probably immaterial to you.
- dnautics 5y agoTo some degree if you really needed the client, it would be almost trivial to import libcurl "as it is" into zig.
- throwaway17_17 5y agoIt’s less a specific domain thing and more an overly opinionated exploration framework for me. Not that it’s really important, but the language is a modal dependent type theory with a compositional (even though most people would call it concatenative) syntax that compiles to C, C++, and JavaScript. So I can always just reuse the underlying platform http and the rest of the stdlib.
- chakkepolja 5y agoI don't think zig is aiming in that category. I see it as a system language. Although these days people want to apply their favorite language to everything, I don't think zig will be a main language for writing web backends or http services. it's place is game engines, computer graphics, kernels, drivers etc..
- koeng 5y agoBasic string manipulation, JSON encoding, file reading/writing, some type of hashing/checksum, and an HTTP client/server. Those things I’ve really appreciated about Go lately as I get it to control robots (controlling them over a REST api on local network writing commands to a serial port).
- naasking 5y ago> Do you feel like http server/client is ‘mandatory’ in a standard library in 2021? A server isn't necessary, but 100% yes for a client. There's a lot of eating your own dog food needed for an http client, like string handling with encodings, network bindings, various collection types, async I/O and/or binary streams, error handling. The resulting client showcases the strengths of the language and its standard library, and most data is on the web today.
- c-cube 5y agoHigh level bindings to cURL would be better imo. You don't reinvent this tricky wheel, and you get a lot of features (even async I think?) on top of a strong implementation. And a http server really doesn't belong in the stdlib of a system language.
- young_unixer 5y agoIn my opinion, that's outside the scope of a general-purpose programming language.
- moogly 5y agoA client, at least, will be needed in the standard library for their upcoming package manager.
- jks 5y agoThey're discussing this in https://github.com/ziglang/zig/issues/910 https://github.com/ziglang/zig/issues/910 (server) and https://github.com/ziglang/zig/issues/2007 https://github.com/ziglang/zig/issues/2007 (client).
- deleted 5y ago[deleted]
- kubb 5y agoYes, a large team of highly paid engineers at Google produced better libraries than that one guy working on Zig as a passion project. And yet that one guy still managed to build in useful features to his language that the Google "geniuses" couldn't think of despite (or because?) decades of experience.