3 ms·
> Odin doesn't do OOP. Zig does. I don't know why a C replacement would try to. What sort of OOP does Zig do, exactly?
by TUSF 4y ago
> Odin doesn't do OOP. Zig does. I don't know why a C replacement would try to.
What sort of OOP does Zig do, exactly?
- alphazard 4y agoThe kind with objects that have methods. Look at the examples. They don't have a class hierarchy, but they have something very similar to Go where a data type (object) "owns" a set of procedures (methods). https://ziglang.org/learn/samples/ https://ziglang.org/learn/samples/ `try int_queue.enqueue(25);` Go has a pretty sane approach to OOP, with methods forming the basis for interfaces (one of Go's most powerful concepts) very nicely. But Go is not really a C replacement. I know Rob Pike said they "started with C", but realistically Go replaced Java in its niche. It's not a C replacement in the way that Zig and Odin are.
- TUSF 4y agoI don't really see this as OOP. It's just sytax sugar.