Are there any languages out there that can only be compiled by a compiler written in their own language? Presumably because the original pre-dogfood compiler stopped being maintained years ago. So that if we somehow lost all binaries of the current compiler, that language would effectively be lost?
Zig self hosted compiler is now capable of building itself
91–100 of 285 posts
Re: Zig self hosted compiler is now capable of building itself
#92I was thinking of learning Rust but it seems a bit overkill due to manual memory management as compared to languages with similar speed like Nim, Zig, and Crystal. How would one compare these languages? Is it worth learning Rust or Zig and dealing with the borrow checker or manual memory management in general, or are GC languages like Nim or Crystal good enough? I'm not doing any embedded programming by the way, just…
I've found that Go is not elegant enough for me and Rust is too difficult to write (I started using Rust in 2015 and after years of trying I eventually realized Rust doesn't make sense for most apps), so I'm all in on Crystal. Despite not having much prior Ruby experience, I absolutely love the language.
For a language that is around 8 years old, this may be a serious problem, since the surrounding ecosystem has been probably written without parallelism in mind, and it may take a very long time to be updated (if ever).
Re: Zig self hosted compiler is now capable of building itself
#93Best alternative to C, built with solid foundation to ensure fast compile speed, fast iteration, and easy to maintain code
I don't understand why people want fast compile speeds so much. My day job is/was writing C on something that requires 30+ minutes for one compilation run. It feels like people want fast compilation speeds because they need to keep running their software for some reason. Fast compilation speeds are a nice to have but basically irrelevant for normal developing of software in my experience.
Your day job project takes half an hour to compile and you don't see the point in speeding that up?
Re: Zig self hosted compiler is now capable of building itself
#94I was thinking of learning Rust but it seems a bit overkill due to manual memory management as compared to languages with similar speed like Nim, Zig, and Crystal. How would one compare these languages? Is it worth learning Rust or Zig and dealing with the borrow checker or manual memory management in general, or are GC languages like Nim or Crystal good enough? I'm not doing any embedded programming by the way, just…
Any programming language is good enough for their own use cases :) It's a matter of understanding which the use cases are.
I'm a big Rust fan, but I nonetheless believe that the use cases for programming languages with manual memory management are comparatively small, in particular, since GC has been improved a lot in the last decade.
For undecided people, I conventionally suggest Golang. Those who at some point need deep control, will recognize it and change accordingly.
Re: Zig self hosted compiler is now capable of building itself
#95Earlier quoted context omitted.
Thanks for the detailed answer! I have more questions, if you'll indulge me: If I understood it correctly, you think smart pointers and reference counting are bad habits. Why? Especially the smart pointers bit. Why does Zig use less memory than other languages? Is it inherent to Zig, or can it be reproduced in other languages?
I think Zig prefers explicit memory management, because allocations may fail and should be handled explicitly, and because automatic deallocations lead to hard-to-predict lifetimes (excess memory usage, and bugs for resource handles that are destructed at hard to predict moments). These are things that a "systems language" programmer should put in the work to do correctly/near-optimally, and not ask the compiler to j…
Re: Zig self hosted compiler is now capable of building itself
#96Earlier quoted context omitted.
imo, most code can do just fine with GC. modern GCs can be relatively low overhead even with guaranteed small pauses (10ms). furthermore, most code that can't handle pauses can be written to not allocate any memory (so GC can be temporarily turned off). as such, the only two places where you need manual allocation are for OS development, and hard real time requirements.
When tail latency (high-percentile latency) is important GC is not a good choice. Wait-free (threads progress independently) concurrent algorithms also need wait-free memory reclamation with bounded memory usage to be able to guarantee progress. But most software are throughput-oriented.
Re: Zig self hosted compiler is now capable of building itself
#97Earlier quoted context omitted.
I don't understand why people want fast compile speeds so much. My day job is/was writing C on something that requires 30+ minutes for one compilation run. It feels like people want fast compilation speeds because they need to keep running their software for some reason. Fast compilation speeds are a nice to have but basically irrelevant for normal developing of software in my experience.
Sorry I may have missed the sarcasm. Your day job project takes half an hour to compile and you don't see the point in speeding that up?
Re: Zig self hosted compiler is now capable of building itself
#98Earlier quoted context omitted.
Why do you trust the assembler you got from somewhere any more than a compiler?
Because hand written assembly is readable!
Or the Verilog/VHDL for the logic gates used by the CPU, for that matter?
Re: Zig self hosted compiler is now capable of building itself
#99Hello HN! Here is some context to decorate this announcement: The Zig self-hosted compiler codebase consists of 197,549 lines of code. There are several different backends, each at varying levels of completion. Here is how many behavior tests are passing: LLVM: 1101/1138 (97%) WASM: 919/1138 (81%) C: 740/1138 (65%) x86_64: 725/1138 (64%) arm: 490/1138 (43%) aarch64: 411/1138 (36%) As you might guess, the one that thi…
> written in Zig instead of C++, uses significantly less memory, and represents a modest performance improvement That's particularly interesting considering the rust compiler in rust has never been as fast as the original OCaml one
Re: Zig self hosted compiler is now capable of building itself
#100Hello HN! Here is some context to decorate this announcement: The Zig self-hosted compiler codebase consists of 197,549 lines of code. There are several different backends, each at varying levels of completion. Here is how many behavior tests are passing: LLVM: 1101/1138 (97%) WASM: 919/1138 (81%) C: 740/1138 (65%) x86_64: 725/1138 (64%) arm: 490/1138 (43%) aarch64: 411/1138 (36%) As you might guess, the one that thi…