Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Zig seems to be a good choice here.


> Rust's compile times are slow. Zig's compile times are fast. This is not the only reason, but it's a big reason.

So why not something like OCaml that has fast compile times and a lot of nice features for writing compilers? (pattern matching, etc.)


I guess if you want to never limit yourself in terms of performance, you're kinda stuck with either C/C++/Zig/Rust/etc.

GCed languages can be fast, probably even as fast as any of the aforementioned languages with enough engineering effort, but in terms of high performance, it's actually easier to write high performance code in the aforementioned languages rather than in a GCed language.


OCaml is fast enough for writing hypervisors, unikernels, networking drivers, powering all Jane Street's business.


The same reason why they're not self-hosting. They want compiler performance to be in the top C, C++, Rust, Zig tier. OCaml isn't slow, but at best it's in the second Java, C#, etc. tier.


Zig's union enums get you something kind of like pattern matching. https://zig.guide/language-basics/unions/


Because, like he said, compile times matter.

This includes the Roc compiler too. Zig is significantly faster than OCaml.


The Ocaml compiler is significantly faster than the Zig one. It's one of the fastest I've seen.


Ah, sorry, I was referring to the speed of the resulting Roc compiler.

A Roc compiler written in Zig would compile Roc code significantly faster than a Roc compiler written in OCaml.


Ah! That makes sense.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: