3 ms·
What does Odin do better than Zig? To me the languages seem very similar except that Zig has its very heavy use of comptime.
by jeltz 4y ago
What does Odin do better than Zig? To me the languages seem very similar except that Zig has its very heavy use of comptime.
- alphazard 4y agoZig's comptime idea is definitely an edge to Zig. It's an elegant feature that solves a lot of problems. However, using it for parametric polymorphism is very clunky. Not that it's a bad way to think about PP, but right now the ergonomics are just not there yet. Odin has a sophisticated PP system, which supports something like dependent types last I checked. Odin's context system is excellent. It is similar to implicits in Scala, but Odin's is by far the best implementation of the idea that I have come across. If Go wanted to make context part of the language, they would do well to understand Odin's context. Odin doesn't do OOP. Zig does. I don't know why a C replacement would try to. As far as leadership, Andrew (Zig) is the better open-source leader. He's better at engaging with the community, attracting people to his cause etc. But as far as a language designer, GingerBill (Odin) really "gets" it. If you listen to him talk about language design, it's very clear he's given it much more consideration than pretty much anyone.
- 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.