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

Essentially enough syntactic sugar so you could write eg the Allocator interface without manually specifying the vtable and the opaque pointer.

But yeah, Go’s system is nice and simple. I am not sure, but I think the fact that Zig programs are a single compilation unit might have some bearing on the orphan rule. There is no concept of crates so “traits”/interfaces can be defined and implemented anywhere.





That's a good point that it's all a single compilation unit which removes the orphan rule problem, but it still has the issue that there could be multiple different implementations of a trait, each from a different dependency.

Though, I am seeing your point on a simple interface system that would be enough to have something like the allocater interface, or the hash map interface.




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

Search: