News for hackers. Stuff that matters.
Re:Lightpanda: The headless browser designed for AI and auto... by hansvm on Saturday January 25, 2025 @12:49AM (#42819795)
Those statements are mostly true and also worth talking about, but they're not pertinent to that error (remotely provided JS not behaving correctly), or the eventual crash (which you'd cause exactly the same way for the same reason in Rust with a .unwrap() call).
Re:Lightpanda: The headless browser designed for AI and auto... by jbggs on Saturday January 25, 2025 @01:48AM (#42819951)
you shouldn't be unwrapping, error cases should be properly handled. users shouldn't see null dereference errors without any context, even in cli tools...
Re:Lightpanda: The headless browser designed for AI and auto... by hansvm on Saturday January 25, 2025 @05:19PM (#42825474)
That too, as a general coding pattern. I was commenting on the criticism of Zig as a sub-par system's language though, contrasting with a language most people with that opinion seem to like.
Re:Lightpanda: The headless browser designed for AI and auto... by IshKebab on Saturday January 25, 2025 @05:14AM (#42820734)
Not exactly the same. `.unwrap()` will never lead to UB, but this can in Zig in release mode.

Also `unwrap()`s are a lot more obvious than just a ?. Dangerous operations should require more ceremony than safe ones. Surprising to see Zig make such a mistake.

Re:Lightpanda: The headless browser designed for AI and auto... by hansvm on Saturday January 25, 2025 @05:29PM (#42825560)
> UB vs "safe" panic

Yes, it's not exactly the same if you compile in ReleaseFast instead of ReleaseSafe. Both are bad though, and I'd tend to blame the coding pattern for the observed behavior rather than quibble about which unacceptable scenario is worse.

I see people adopting forced null unwrapping for dumb reasons all the time. For the remaining reasons, do you have a sense of what the language deficiencies are which make that feature helpful? I see it for somewhat sane reasons when crossing language boundaries. Does anything else stand out?

> ceremony

Yes. Thankfully ".?" is greppable, but I wouldn't mind more ceremony there, and less for `try` coding patterns.