frontpage.
newsnewestaskshowjobs

Made with ♥ by @iamnishanth

Open Source @Github

fp.

OpenCiv3: Open-source, cross-platform reimagining of Civilization III

https://openciv3.org/
610•klaussilveira•12h ago•180 comments

The Waymo World Model

https://waymo.com/blog/2026/02/the-waymo-world-model-a-new-frontier-for-autonomous-driving-simula...
913•xnx•17h ago•546 comments

What Is Ruliology?

https://writings.stephenwolfram.com/2026/01/what-is-ruliology/
28•helloplanets•4d ago•21 comments

How we made geo joins 400× faster with H3 indexes

https://floedb.ai/blog/how-we-made-geo-joins-400-faster-with-h3-indexes
102•matheusalmeida•1d ago•24 comments

Unseen Footage of Atari Battlezone Arcade Cabinet Production

https://arcadeblogger.com/2026/02/02/unseen-footage-of-atari-battlezone-cabinet-production/
31•videotopia•4d ago•1 comments

Show HN: Look Ma, No Linux: Shell, App Installer, Vi, Cc on ESP32-S3 / BreezyBox

https://github.com/valdanylchuk/breezydemo
209•isitcontent•12h ago•24 comments

Monty: A minimal, secure Python interpreter written in Rust for use by AI

https://github.com/pydantic/monty
206•dmpetrov•12h ago•99 comments

Show HN: I spent 4 years building a UI design tool with only the features I use

https://vecti.com
316•vecti•14h ago•139 comments

Microsoft open-sources LiteBox, a security-focused library OS

https://github.com/microsoft/litebox
355•aktau•18h ago•180 comments

Sheldon Brown's Bicycle Technical Info

https://www.sheldonbrown.com/
361•ostacke•18h ago•94 comments

Hackers (1995) Animated Experience

https://hackers-1995.vercel.app/
466•todsacerdoti•20h ago•232 comments

Jeffrey Snover: "Welcome to the Room"

https://www.jsnover.com/blog/2026/02/01/welcome-to-the-room/
4•kaonwarb•3d ago•1 comments

Delimited Continuations vs. Lwt for Threads

https://mirageos.org/blog/delimcc-vs-lwt
25•romes•4d ago•3 comments

Show HN: If you lose your memory, how to regain access to your computer?

https://eljojo.github.io/rememory/
263•eljojo•15h ago•156 comments

An Update on Heroku

https://www.heroku.com/blog/an-update-on-heroku/
398•lstoll•18h ago•271 comments

Dark Alley Mathematics

https://blog.szczepan.org/blog/three-points/
80•quibono•4d ago•20 comments

PC Floppy Copy Protection: Vault Prolok

https://martypc.blogspot.com/2024/09/pc-floppy-copy-protection-vault-prolok.html
54•kmm•4d ago•3 comments

Was Benoit Mandelbrot a hedgehog or a fox?

https://arxiv.org/abs/2602.01122
9•bikenaga•3d ago•2 comments

How to effectively write quality code with AI

https://heidenstedt.org/posts/2026/how-to-effectively-write-quality-code-with-ai/
239•i5heu•15h ago•182 comments

Introducing the Developer Knowledge API and MCP Server

https://developers.googleblog.com/introducing-the-developer-knowledge-api-and-mcp-server/
50•gfortaine•9h ago•15 comments

I spent 5 years in DevOps – Solutions engineering gave me what I was missing

https://infisical.com/blog/devops-to-solutions-engineering
138•vmatsiiako•17h ago•60 comments

Understanding Neural Network, Visually

https://visualrambling.space/neural-network/
274•surprisetalk•3d ago•37 comments

Show HN: R3forth, a ColorForth-inspired language with a tiny VM

https://github.com/phreda4/r3
68•phreda4•11h ago•13 comments

Why I Joined OpenAI

https://www.brendangregg.com/blog/2026-02-07/why-i-joined-openai.html
126•SerCe•8h ago•108 comments

Female Asian Elephant Calf Born at the Smithsonian National Zoo

https://www.si.edu/newsdesk/releases/female-asian-elephant-calf-born-smithsonians-national-zoo-an...
28•gmays•7h ago•9 comments

I now assume that all ads on Apple news are scams

https://kirkville.com/i-now-assume-that-all-ads-on-apple-news-are-scams/
1051•cdrnsf•21h ago•432 comments

Vocal Guide – belt sing without killing yourself

https://jesperordrup.github.io/vocal-guide/
7•jesperordrup•2h ago•2 comments

Learning from context is harder than we thought

https://hy.tencent.com/research/100025?langVersion=en
172•limoce•3d ago•93 comments

FORTH? Really!?

https://rescrv.net/w/2026/02/06/associative
61•rescrv•19h ago•22 comments

Zlob.h 100% POSIX and glibc compatible globbing lib that is faste and better

https://github.com/dmtrKovalenko/zlob
15•neogoose•4h ago•9 comments
Open in hackernews

Interfaces and Traits in C

https://antonz.org/interfaces-in-c/
17•ibobev•2w ago

Comments

jamesmunns•2w ago
Speaking as someone familiar with C and Rust (not so much Go!), although there's a parallel here to Rust's Traits, this actually is much closer to dyn Trait in Rust, which uses vtables and runtime polymorphism, rather than "regular" Traits in Rust, which are monomorphized versions of similar interface constraints, much closer to C++'s templates (or concepts, I'm hand waving here).

This isn't necessarily a negative, sometimes you actually prefer vtables and runtime polymorphism for various reasons like flexibility, or code size reasons. Just wanted to add some flavor for folks that aren't as familiar with Rust, that this isn't exactly how things usually work, as "regular" Trait usage is much more common than dyn Trait usage, which you have to explicitly opt-in to.

EPWN3D•2w ago
I've wound up just putting the protocol state in a struct and making the "conforming" action to have that struct in the conforming object with a standardized field name. Then just use a macro to get the protocol pointer and pass it to the protocol's implementation functions.

But I really, really wish we could have a lightweight protocol/trait feature in C. It would remove a large source of unsafe code that has to cast back and forth between void *.

wasmperson•2w ago
I think it's best to avoid this kind of "re-inventing OOP in C" thing, even though it can be tempting when coming from other languages. Regardless, some notes:

- It's UB to alias one struct pointer with that of a different struct type, even if the two structs have the same first few members. Clang and GCC both exploit this for optimizations, although you can configure them not to.

- Casting function pointers is also problematic, although I think that one is more of a portability issue.

- If you want to "downcast" from a "base" struct to an "inheriting" struct, you can use the `container_of` macro, which is robust against member re-arrangement and supports multiple inheritance:

  #include <stdio.h>
  #include <stdint.h>
  #include <stddef.h>
  
  #define container_of(p, t, f) ((t *)((char *)(0?&((t *)0)->f:p)-offsetof(t, f)))
  
  struct reader { size_t (*read)(struct reader *self, uint8_t *p, size_t len); };
  struct zeros { struct reader base; size_t total; };
  
  size_t zeros_read(struct reader *self_, uint8_t *p, size_t len){
      struct zeros *self = container_of(self_, struct zeros, base);
      //...
  }
- Interfaces in other languages exist to add type safety to dynamic dispatch. You get none of that in C, though, due to the casting you have to perform regardless. Code which just "does the obvious thing" using void pointers will be much simpler, making it better IMO despite the lack of type "safety":

  #include <stdio.h>
  #include <stdint.h>
  
  typedef size_t read_fn(void *ctx, uint8_t *p, size_t len);
  
  size_t work(void *ctx, read_fn *read){
      uint8_t buf[8];
      return read(ctx, buf, sizeof buf);
  }
  
  struct zeros_reader { size_t total; };
  
  size_t zeros_read(void *ctx, uint8_t *p, size_t len){
      struct zeros_reader *self = ctx;
      for(size_t i = 0; i < len; i++) p[i] = 0;
      self->total += len;
      return len;
  }
  
  int main(void){
      struct zeros_reader z = {0};
      work(&z, zeros_read);
      work(&z, zeros_read);
      printf("total = %zu\n", z.total);
  }