As stated in the issues linked by wsppan, you shouldn't take for granted that there will be an http server in the stdlib.
It will take a while before you will see a fully-featured, production ready HTTP server implementation, so here's a hot take: instead of waiting till then, write the HTTP layer in Go or Elixir and use Zig to implement the business logic.
For Elixir, you can use https://github.com/ityonemo/zigler and for Go you just need to look into the C FFI interface and if you need cross-compilation you can use Go with Zig cc, roughly as explained here https://dev.to/kristoff/zig-makes-go-cross-compilation-just-work-29ho
You could also find an http server implemented in C and use that from Zig, but cross-compilation might be more problematic at that point, depending on how portable the C project is.
This is great.
I'm also new to Zig coming from Go/Python. I have been meaning to port over some Go stdlibs to Zig especially https://golang.org/pkg/strings/ This will serve as inspiration.
Asante sana.
Hi, I'm one of the maintainers of Rouge. Thanks /u/AntiRedditFa for making the PR! :)
I just wanted to note that the ability to use this with GitHub Pages depends on GitHub updating their version of Rouge to v3.20.0+. They're usually pretty responsive but as of this writing they're using v3.19.0 so Zig support won't work at the moment.
You can see the versions of gems used by GitHub Pages here.
I edited the code into the original post, ran it with `zig run src/exec.zig`.
I adapted the code from `cli.zig`and `docgen.zig`
syscalls are expensive. Buffered reader makes few syscalls, doing most of the work in program memory.
What's doubly important to note, is that readUntilDelimiterOrEof reads a single byte at a time. So for a 27mb file, your program was doing something like 28 million syscalls - not cheap!
I lost the fixed code and decided to give it another go after forgetting about it: https://hastebin.com/yucebobona.swift
I can't figure out what's different now, but I have the same problem all over again.
You're thinking of something like D's <code>rdmd</code>?
It'd need a bit of tooling and (optionally) language support for shebangs, but those shouldn't be insurmountable if it's something the Zig devs are interested in.
nim compiles down to c, and then uses a c compiler to do make the executable (apparently it also supports targeting Javascript). He's suggesting that you can use zig as the c compiler (see bottom of the FAQ), or, to take it a step further, that nim could use zig as the builtin c compiler.