News for hackers. Stuff that matters.
Re:In Zig, What's a Writer? by Arch485 on Saturday February 01, 2025 @06:16AM (#42897553)
VTable structs. Instead of declaring `interface Foo { void bar(); }`, you do `struct Foo { this: void, bar: const fn (this: *void); }` (i.e. a struct with a function pointer field and a "this" pointer). This is how interfaces work under the hood in other languages.

Note that the code I wrote is not any particular language; it's just demonstrative.

There are no comments on this comment yet.