frontpage.
newsnewestaskshowjobs

Made with ♥ by @iamnishanth

Open Source @Github

I want everything local – Building my offline AI workspace

https://instavm.io/blog/building-my-offline-ai-workspace
869•mkagenius•19h ago•229 comments

Partially Matching Zig Enums

https://matklad.github.io/2025/08/08/partially-matching-zig-enums.html
84•ingve•4h ago•26 comments

Jan – Ollama alternative with local UI

https://github.com/menloresearch/jan
28•maxloh•3h ago•8 comments

Tribblix – The Retro Illumos Distribution

http://www.tribblix.org/
60•bilegeek•6h ago•11 comments

Ultrathin business card runs a fluid simulation

https://github.com/Nicholas-L-Johnson/flip-card
1031•wompapumpum•1d ago•207 comments

Stanford to continue legacy admissions and withdraw from Cal Grants

https://www.forbes.com/sites/michaeltnietzel/2025/08/08/stanford-to-continue-legacy-admissions-and-withdraw-from-cal-grants/
14•hhs•41m ago•2 comments

Sandstorm- self-hostable web productivity suite

https://sandstorm.org/
84•nalinidash•7h ago•19 comments

Car has more than 1.2M km on it – and it's still going strong

https://www.cbc.ca/news/canada/nova-scotia/1985-toyota-tercel-high-mileage-1.7597168
54•Sgt_Apone•3d ago•63 comments

Breaking the Sorting Barrier for Directed Single-Source Shortest Paths

https://arxiv.org/abs/2504.17033
72•pentestercrab•8h ago•2 comments

Why Wisconsin's county highways are lettered, not numbered (2019)

https://www.wpr.org/transportation/why-wisconsins-county-roads-are-lettered-not-numbered
16•kaladin-jasnah•3d ago•10 comments

Private Welsh island with 19th century fort goes on the market

https://www.cnn.com/2025/08/08/business/thorne-island-fort-wales-scli-intl
18•makaimc•1h ago•6 comments

Tor: How a military project became a lifeline for privacy

https://thereader.mitpress.mit.edu/the-secret-history-of-tor-how-a-military-project-became-a-lifeline-for-privacy/
354•anarbadalov•21h ago•168 comments

A SPARC makes a little fire

https://www.leadedsolder.com/2025/08/05/sparcstation-scsi-termination-fix-magic-smoke.html
49•zdw•3d ago•6 comments

Representing Python notebooks as dataflow graphs

https://marimo.io/blog/dataflow
51•akshayka•3d ago•6 comments

A Brief Publishing History of Don Quixote (2024)

https://www.swanngalleries.com/news/books/2024/04/a-brief-publishing-history-of-don-quixote/
5•jbperry•2d ago•3 comments

Getting good results from Claude Code

https://www.dzombak.com/blog/2025/08/getting-good-results-from-claude-code/
394•ingve•23h ago•156 comments

I bought a £16 smartwatch just because it used USB-C

https://shkspr.mobi/blog/2025/08/i-bought-a-16-smartwatch-just-because-it-used-usb-c/
219•blenderob•3d ago•162 comments

Our European search index goes live

https://blog.ecosia.org/launching-our-european-search-index/
122•maelito•16h ago•57 comments

What the Windsurf sale means for the AI coding ecosystem

https://ethanding.substack.com/p/windsurf-gets-margin-called
144•whoami_nr•10h ago•36 comments

Let's properly analyze an AI article for once

https://nibblestew.blogspot.com/2025/08/lets-properly-analyze-ai-article-for.html
108•pabs3•11h ago•70 comments

Hacking Diffusion into Qwen3 for the Arc Challenge

https://www.matthewnewton.com/blog/arc-challenge-diffusion
107•mattnewton•3d ago•10 comments

How we replaced Elasticsearch and MongoDB with Rust and RocksDB

https://radar.com/blog/high-performance-geocoding-in-rust
255•j_kao•1d ago•73 comments

Efrit: A native elisp coding agent running in Emacs

https://github.com/steveyegge/efrit
135•simonpure•18h ago•26 comments

I prefer human-readable file formats

https://adele.pollux.casa/check-human.php?redirect=%2Fgemlog%2F2025-08-04_why_I_prefer_human-readble_file_formats.gmi
58•Bogdanp•4h ago•48 comments

What's wrong with the JSON gem API?

https://byroot.github.io/ruby/json/2025/08/02/whats-wrong-with-the-json-gem-api.html
55•ezekg•3d ago•16 comments

Jim Lovell, Apollo 13 commander, has died

https://www.nasa.gov/news-release/acting-nasa-administrator-reflects-on-legacy-of-astronaut-jim-lovell/
545•LorenDB•18h ago•108 comments

Astronomy Photographer of the Year 2025 shortlist

https://www.rmg.co.uk/whats-on/astronomy-photographer-year/galleries/2025-shortlist
226•speckx•23h ago•32 comments

Ask HN: How can ChatGPT serve 700M users when I can't run one GPT-4 locally?

468•superasn•18h ago•302 comments

Datalog-Based Binary Equivalence

https://github.com/binaryeq/daleq
5•xupybd•4h ago•0 comments

Window Activation

https://blog.broulik.de/2025/08/on-window-activation/
211•LorenDB•5d ago•123 comments
Open in hackernews

Partially Matching Zig Enums

https://matklad.github.io/2025/08/08/partially-matching-zig-enums.html
84•ingve•4h ago

Comments

spiffyk•3h ago
This post shows how versatile Zig's comptime is not only in terms of expressing what to pre-compute before the program ever runs, but also for doing arbitrary compile time bug-checks like these. At least to me, the former is a really obvious use-case and I have no problem using that to my advantage like that. But I often seem to overlook the latter, even though it could prove really valuable.
dwattttt•3h ago
I love the idea, but something being "provable" in this way feels like relying on optimisations.

If a dead code elimination pass didn't remove the 'comptime unreachable' statement, you'll now fail to compile (I expect?)

anonymoushn•3h ago
A lot of Zig relies on compilation being lazy in the same sort of way.
dwattttt•3h ago
For the validity of the program? As in, a program will fail to compile (or compile but be incorrect) if an optimisation misbehaves?

That sounds as bad as relying on undefined behaviour in C.

Laremere•2h ago
It's not an optimization. What gets evaluated via the lazy evaluation is well defined. Control flow which has a value defined at comptime will only evaluate the path taken. In the op example, the block is evaluated twice, once for each enum value, and the inner switch is followed at comptime so only one prong is evaluated.
anonymoushn•2h ago
Well, for example you may have some functions which accept types and return types, which are not compatible with some input types, and indicate their incompatibility by raising an error so that compilation fails. If the program actually does not pass some type to such a function that leads to this sort of error, it would seem like a bug for the compiler to choose to evaluate that function with that argument anyway, in the same way that it would be a bug if I had said "template" throughout this comment. And it is not generally regarded as a deficiency in C++ that if the compiler suddenly chose to instantiate every template with every value or type, some of the resulting instantiations would not compile.
dwattttt•2h ago
To take an extreme example, what if I asserted the Riemann hypothesis in comptime? It's relying on comptime execution to act as a proof checker.

Which is fine for small inputs and uses, but it's not something that would scale well.

9029•1h ago
Nope, this is not relying on optimization, it's just how compile time evaluation works. The language guarantees "folding" here regardless of optimization level in use. The inline keyword used in the original post is not an optimization hint, it does a specific thing. It forces the switch prong to be evaluated for all possible values. This makes the value comptime, which makes it possible to have a comptime unreachable prong when switching on it.

There are similarities here to C++ if constexpr and static_assert, if those are familiar to you.

teiferer•20m ago
It's inherently an incomplete heutistic. Cf. the halting problem.

Doesn't mean it's not useful.

dlahoda•3h ago
fn main() {

    if false {

        const _:() =  panic!();

    }
}

Fails to compile in Rust.

Ygg2•2h ago
Why would it? If I recall correctly, const and static stuff basically gets inlined at the beginning of the program.
Sharlin•2h ago
Sure, because it's compile-time code inside a (semantically) run-time check. In recent Rust versions you can do

    fn main() {
        const {
            if false {
                let _:() = panic!();
            }
        }
    }
which compiles as expected. (Note that if the binding were `const` instead of `let`, it'd still have failed to compile, because the semantics don't change.)
tialaramex•26m ago
Perhaps more succinctly:

    fn main() {
       const _:() = const { if false { panic!() } };
    }
It's fine that we want a constant, it's fine that this constant would, when being computed at compile time, panic if false was true, because it is not.
judofyr•3h ago
This is one the reasons I find it so silly when people disregard Zig «because it’s just another memory unsafe language»: There’s plenty of innovation within Zig, especially related to comptime and metaprogramming. I really hope other languages are paying attention and steals some of these ideas.

«inline else» is also very powerful tool to easily abstract away code with no runtime cost.

Ygg2•2h ago
> «inline else» is also very powerful tool to easily abstract away code with no runtime cost.

Sure, but you lose the clarity of errors. The error wasn't in `comptime unreachable` but in `inline .a .b .c`.

jeltz•2h ago
I disagree, I would say the error is in "comptime unreachable" or maybe the whole "switch (ab)".
binary132•1h ago
Adding a new case is legitimate, failing to handle it (by reaching unreachable) is an error.
diegocg•2h ago
As someone who uses D and has been doing things like what you see in the post for a long time, I wonder why other languages would put attention to these tricks and steal them when they have been completely ignoring them forever when done in D. Perhaps Zig will make these features more popular, but I'm skeptic.
brabel•2h ago
I was trying to implement this trick in D using basic enum, but couldn't find a solution that works at compile-time, like in Zig. Could you show how to do that?
chrismorgan•1h ago
What I’ve seen isn’t people disregarding Zig because it’s just another memory-unsafe language, but rather disqualifying Zig because it’s memory-unsafe, and they don’t want to deal with that, even if some other aspects of the language are rather interesting and compelling. But once you’re sold on memory safety, it’s hard to go back.
Sytten•1h ago
This is really the crust of the argument. I absolutely love the Rust compiler for example, going back to Zig would feel a regression to me. There is a whole class of bugs that my brain now assumes the compiler will handle for me.
pron•1h ago
Problem is, like they say the stock market has predicted nine of the last five recessions, the Rust compiler stops nine of every five memory safety issues. Put another way, while both Rust and Zig prevent memory safety issues, Zig does it with false negatives while Rust does it with false positives. This is by necessity when using the type system for that job, but it does come at a cost that disqualifies Rust for others...

Nobody knows whether Rust and/or Zig themselves are the future of low-level programming, but I think it's likely that the future of low-level programming is that programmers who prefer one approach would use a Rust-like language, while those who prefer the other approach would use a Zig-like language. It will be intesting to see whether the preferences are evenly split, though, or one of them has a clear majority support.

tialaramex•33m ago
C++ already illustrates this idea you're talking about and we know exactly where this goes. Rust's false positives are annoying, so programmers are encouraged to further improve the borrowck and language features to reduce them. But the C++ or Zig false negatives just means your program malfunctions in unspecified ways and you may not even notice, so programmers are encouraged to introduce more and more such cases to the compiler.

The drift over time is predictable, compared to ten years ago Rust has fewer false positives, C++ has more false negatives.

You are correct to observe that there is no middle choice here, that's Rice's Theorem, non-trivial semantic correctness is Undecidable. But I would argue we already know what you're calling the "false positive" scenario is also not useful, we're just not at the point where people stop doing it anyway.

pron•1h ago
> just another memory unsafe language

Also, treating all languages that don't ensure full memory safety as if they're equally problematic is silly. The reason not ensuring memory safety is bad is because memory unsafety as at the root of some bugs that are both common, dangerous, and hard to catch. Only not all kinds of memory unsafety are equally problematic, Zig does ensure the lack of the the most dangerous kind of unsafety (out-of-bounds access) while making the other kind (use-after-free) easier to find.

That the distinction between "fully memory safe" and "not fully memory safe" is binary is also silly not just because of the above, but because no lanugage, not even Java, is truly "fully memory safe", as programs continue to employ components not written in memory safe languages.

Furthermore, Zig has (or intends to have) novel features (among low-level languages) that help reduce bugs beyond those caused by memory unsafety.

IshKebab•29m ago
Right but I think people are disappointed because we finally got a language that has memory safety without GC, so Zig seems like a step backwards. Even if it is much much better than C (clearly), it's hard to get excited about a language that "unsolves" a longstanding problem.

> not even Java, is truly "fully memory safe", as programs continue to employ components not written in memory safe languages.

This is a silly point.

veber-alex•1h ago
I don't understand. Isn't this only useful if the value you match on is known at compile time?