Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

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.



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: