Hacker News new | past | comments | ask | show | jobs | submit
Isn’t it written in Zig? Not sure how that is “highly portable” compared to C
Yeah, the definition of "portable" being used is one that is not useful for most users, the fact that it's not in Fedora and neither Debian is a sign of it. Especially considering the demand for ghostty, it's a very cool project.

Someone willing to distribute ghostty has to pull in a whole programing language stack just for it, ghostty seems to be the most important project written in zig so far.

For the definition of portable that matters to me, this is the least portable possible, if it was written in almost any other language it would have been more portable. And yes, this all goes away once zig is onboarded to all distros, then it becomes "empirically portable", but we're not there yet.

PS.: "Portable" meaning which CPU architectures are supported is not a very useful meaning of the word for me, even though it's more accurate, it says nothing about the ability to actually build and run it in different OSes.

> has to pull in a whole programing language stack just for it

That’s implying a lot more than I think is the case for Zig.

Zig itself is a very lean and independent executable. It’s just one binary. Statically linked on Linux I believe. It’s even moving toward removing LLVM dependence.

I don’t know of any other language that aims to be as portable as Zig, including C itself. Of course, not all of those goals have been realised yet, but at this stage I don’t think there’s much preventing portability from Zig’s part itself, other than more architectures supported in its own compiler backend. And I suppose a 1.0 release would make it easier to get the compiler more widely distributed.

Zig can also compile to C so at least it's as portable.
In a sense I would expect C to be the most portable language ever* so I am not sure how good of a comparison candidate it is

* With some UB herbs and spices

From https://ziglang.org/intro/overview/

  Zig is also a C compiler

  Here’s an example of Zig building some C code:

  hello.c
  > #include <stdio.h>
  >
  > int main(int argc, char **argv) {
  >   printf("Hello world\n");
  >   return 0;
  > }
  

  $ zig build-exe hello.c -lc
  $ ./hello
  > Hello world
What does that have to do with portability? It doesn’t support a bunch of CPU architectures, the portability metric I care about.
I misread the comment I was replying to, thinking it was about using Zig to port something, when it was actually about porting something that uses Zig.
I/my agent somehow integrated it into a C++ app on Windows. So one way or another, it does work.
Zig is even more portable than C
You’re kidding right? That’s not what the support matrix on the Zig site shows. Plenty of CPU archs in Tier 3/4. No support for Alpha, HPPA, M68K, Sparc, or SuperH.
"portable" and "has ports" mean two different things. there might be targets Zig doesn't have great support for yet but what I meant is that bootstrapping a target to Zig is a simpler endeavor than it is for C
Is it? I think zig use llvm codegen. Once you got llvm for your architecture, you get 99% of modern language
LLVM codegen is optional, and LLVM is being turned into a runtime dependency.

Zig has its own compiler backend. With limited arch support of course. Only used in debug modes for now.

I think the most interesting part is they rely on WASM for bootstrapping so all you need to make to bootstrap Zig anywhere is a WASM interpreter (if I understand correctly).