logoalt Hacker News

Why we built Lightpanda in Zig

132 pointsby ashvardaniantoday at 6:29 PM65 commentsview on HN

Comments

gorjusborgtoday at 7:39 PM

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.

show 3 replies
dzogchentoday at 10:34 PM

> 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.

drnick1today at 8:14 PM

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.

show 1 reply
0xbadcafebeetoday at 8:55 PM

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.

show 2 replies
lvl155today at 7:16 PM

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.

motoboitoday at 7:44 PM

I'm starting to form an image of the zig community: people that like to write and reason, nice typography, videogame inspired visuals.

coppsilgoldtoday at 10:12 PM

Lightpanda doesn't appear to be interested in impersonating a more popular browser. How will such a strategy not end in failure?

show 1 reply
cloudheadtoday at 10:08 PM

> LLMs deserve a 100x better browser.

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

show 1 reply
loxodrometoday at 8:14 PM

I just want Zig with classes, Zig++. :(

show 3 replies
Svokatoday at 9:48 PM

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.

observationisttoday at 7:17 PM

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.

show 1 reply
jkelleyrtptoday at 8:33 PM

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

show 2 replies
websiteapitoday at 6:59 PM

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?

show 15 replies
Svokatoday at 8:42 PM

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.

mustpaxtoday at 7:30 PM

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?

show 2 replies