27 comments

[ 5.7 ms ] story [ 53.5 ms ] thread
has there ever been a project that became popular and/or successful because of its programming language? does it really matter to the end user what language it's in if it works well?
This is actually a great summary of Zig. I am with the author: I am too old and stupid to use Rust properly. Whenever I watch someone like Gjengset write Rust, I realize I am doing it wrong.
I'd like to see a setup with Lightpanda feeding a local/private AI, with content rendered post-curation. You could filter out all the garbage at the intake, instead of doing all the plug-ins, extensions, add-ons, DNS and whackamole arms race.

AI researchers need to hurry up and invent the next big paradigm shift so AI on your phone is as good as SoTA bots, so we can stay ahead of the enshittification curve.

Awesome software - I've been meaning to build a crawler and this does the trick.

(comment deleted)
I feel like I’m missing something. How do people justify the security implications of manual memory management when building a publicly accessible web service with Zig?
Years ago, when I initially picked up Rust, I loved it. It does a lot of things right. At the same time, though, I knew there was a possibility of it going wrong in two opposite directions:

1. Developers balked at being required to take on the cognitive load required to allow GC-less memory management

2. Developers wore their ability to take on that cognitive load as a badge of honor, despite it not being in their best interest

I eventually came to the decision to stop developing in Rust, despite its popularity. It is really cool that its creators pulled it off. It was quite an achievement, given how different it was when it came out. I think that if I had to implement a critical library I would consider using Rust for it, but as a general programming language I want something that allows me to focus my mental facilities on the complexities of the actual problem domain, and I felt that it was too often too difficult to do that with Rust.

So what do you use instead now?
I'm starting to form an image of the zig community: people that like to write and reason, nice typography, videogame inspired visuals.
Agree, it's funny to see how that seems to be developing organically!
I have seen this time and time again: first complain that C/C++ are too complex or lack feature X, new language is proposed, then sooner or later people find out that's it's not fast, expressive, flexible enough or imposes a nonstandard way of doing things (Rust), then back to C/C++ and few years after the cycle repeats.
I just want Zig with classes, Zig++. :(
I'm longing for Zig--. :(

And also for Hype-- about all these newfangled langs.

I mean you can opine about how Rust isn't suited for browser development, but as someone building a browser in Rust, I think it's just fine. If anything, Rust has been really shining in this project since Rust was designed to build a web browser.

https://github.com/dioxuslabs/blitz

Also I think it's a little ridiculous to build yet another new browser in a new language when so many amazing pieces are just sitting around ready for someone to use. Come contribute, we're already much further along :)

https://github.com/DioxusLabs/blitz/pull/292

I was using C++ and C for decades, and I do a lot of embedded programming for fun. I switched completely to Rust about half a year ago. Friction went away very fast. Fun thing is that looking at my old C code now I see so many pitfalls I was oblivious about, just because I started to use Rust.

I mean, Rust does have a learning curve, but its complexity is overexaggerated imo. Yes, you have to learn something new, but how it is a problem?

I don't understand why pick language because it looks familiar and you don't have to change how you think. For me that is basically a problem with Zig - I can do everything Zig does in C++, having decades of libraries and infra while Rust actually contributes to the end product.

Keep in mind you'll be using a different language in the future. All software is maintained for a given amount of time and then sunset. What matters is the lifecycle of the thing you're making now. Pick whatever is maintainable for that application and time frame.

Throwaway script? Use anything. A mobile app? Whatever gets it on the devices you're targeting today, that works for the life of the device/OS/etc. A backend API that will power a large platform? Something maintainable (by people other than yourself) for 3-5 years. Firmware for IoT that will remain in industrial systems for 20 years? Something that is well established and supported with a good number of other people who can fix it in the long haul.

(comment deleted)
The biggest reason against Rust is 3 year old article from personal blog. Trying to reproduce benchmark result from it result in failure because Zig code fails to compile.

Meanwhile Rust compiles just fine. Even updating toolchain to newest causes no issues and benchmark still runs. All I had to do is remove pinning to old toolchain, and bump language version to latest. Also changing dependency version to latest worked without an issue.

You'd think that performing all advanced memory manipulations you would want all the safety you want, but hey. Zig is cool this days.

Go figure.

I've written a fair amount of code in Rust and D and a little less in Zig. In my opinion, Zig was not ready for prime time when I used it -- too many bugs -- and that may still be true. Rust is hard to learn and even after you do, it gets in the way a lot. D is very nice if you like C, but there are a lot of problems with the project and the tooling.

I'm about to say something that will likely surprise you; it surprised me: have you folks thought about Ada? I was around, working on (D)ARPA contracts at BBN, when Ada was designed. We didn't use it, so I had no opinion of it at the time. I thought it had dried up and blown away in the decades since, like PL1.

Well, it's now #17 on the Tiobe index and climbing. So I gave it a try for a small project. My reaction is very positive. The language is well-designed, obviously having learned a lot of lessons from the mistakes of C, among other things. The compiler, gnat, is built on gcc. Compilation times are very fast, execution times are fast, it works well with gdb, and it's well documented. It avoids many of the traps of C (no pointer arithmetic, no automatic type conversions) and it just feels carefully engineered. It's been used to build a lot of applications in areas like train control and aviation where you just can't screw up because people may die if you do.

Based on my experience with writing and debugging a little over a thousand lines of code (so not a lot), I'm very impressed -- it's surprisingly good. I'd suggest giving it consideration if/when the opportunity presents itself.

> LLMs deserve a 100x better browser.

Hold on, why can't humans have a 100x better browser?

Because a human browser has to implement CSS.
Lightpanda doesn't appear to be interested in impersonating a more popular browser. How will such a strategy not end in failure?
> Anyone who’s fought with CMake or dealt with header file dependencies knows this pain. For a small team trying to move quickly, we didn’t want to waste time debugging build configuration issues.

I find this take a bit hard to believe. There's no way that Zig is some kind of magic bullet that avoids build configuration challenges. Especially not considering you are building a browser on top of V8 in a different programming language.

CMake is quite crufty, but there's toolchains for every system under the Sun and this is what makes it actually less painful in a lot of cases. Glossing over your build files it does not look particularly scalable or portable. Nice that Zig allows you to write build config in Zig though.

I wrote an article (this morning actually!) on picking up Rust to combat AI brain atrophy. My background is JVM-based (Kotlin), and my main contenders were Go vs Rust vs Zig.

My reasoning for settling on Rust:

If I wanted something more general-purpose and ergonomic, I'd stick with something like Kotlin, which has wider ecosystem support. Go could fit here too, but I've heard from more experienced folks that Go's simplicity can get limiting as codebases grow (and requires 100s of developers to be disciplined). Not impossible, just not as conducive.

But since I specifically wanted a performant systems language, I figured I'd go to the other extreme. So my choice was Rust or Zig. I eventually chose Rust (as complicated as Rust can seem) the borrow checker is pretty elegant once it clicks and provides the necessary safety net for a language I intentionally am choosing for more control.

(here's my article on learning Rust if folks are interested: https://kau.sh/blog/learn-rust-ai-atrophy/) - different angle from the linked article.

> Zig particularly shines: comptime metaprogramming, explicit memory allocators, and best-in-class C interoperability. Not to mention the ongoing work on compilation times

The D programming language shines:

comptime: https://dlang.org/spec/function.html#interpretation

metaprogramming: https://dlang.org/spec/template.html#function-templates

explicit memory allocators: these are easily made, there's nothing special about them, I use them all the time

best-in-class C interoperability: Nothing beats D's ImportC, where you can import a .c file as if it were a module. You can even use ImportC to translate your C code to D! https://dlang.org/spec/importc.html

Performance: same as C and C++

I guess there are different levels of meta-programming. You can go really far in Rust/C++ too but I think Zig is really unique that you can write a function, which takes a type, it does some imperative mumbo-jumbo and spits out another type, doing exactly what you want, without having to think about restrictions, trait bounds, or whatever.

For example, here's comptime dependency-injection container, which notably, can be configured and extended, completely in comptime, and the final glue is something which in theory the compiler could optimize away too (no idea if it does). https://github.com/cztomsik/tokamak/blob/main/src/container....

And regarding what they discuss in article, I did something similar for N-API, note how much you can do in few hundred lines, and I'd say that you can use it for most of what people do with napi-rs except that napi-rs is huge (and also unsafe, because it allows indirect recursion, which allows breaking all the rustc promises) https://github.com/cztomsik/napigen/blob/main/src/napigen.zi...

Gotta admit there is something funny about a browser company saying Rust is not well suited for browser development given why it was created in the first place
Sounds fast. Does it respect `robots.txt`? My web services are not written in Rust, Zig, or Go. :)