6 ms·
How does this compare to Zig or Odin, which have the same goals of improving upon C and have gotten occasional publicity here on HN?
by dooglius 2y ago
How does this compare to Zig or Odin, which have the same goals of improving upon C and have gotten occasional publicity here on HN?
- deleted 2y ago[deleted]
- johnisgood 2y agoIt is answered here: https://c3-lang.org/faq/compare-languages/ https://c3-lang.org/faq/compare-languages/
- dkersten 2y agoI feel like its missing a point for "In C3 but not in Jai": you can actually download and use C3...
- lerno 2y agoWell, it's not that difficult to get into the Jai beta if you are building something with Jai I think? I seem to recall that Jon just asked beta testers that they actually have a project that they will use it for?
- dkersten 2y agoHow can you build something in Jai before you have access to Jai? I heard he only gives access to people who more out less guarantee they will use it relatively heavily, but how can I know of I will before I can scarily try it? Basically I heard he only gives access if he thinks you will use it — not just so you can try it. That might work fine for people with enough time on their hands that they can say “I’ll do this full project in it, regardless of how it goes”, but I prefer to be able to tinker first to see if I find it suitable. For example, I’ve had projects where I though “ok I’m going to do this in Rust|Zig” and after trying for a few days realising that it’s not the route I want to take. In any case, anyone can just download C3 and try it. You can’t just download Jai to try it. So my statement is still true.
- pajko 2y agoThis is missing Nim.
- lerno 2y agoI haven't used Nim enough to write a good comparison. I am not mentioning Crystal either. If someone wants to contribute a comparison I'd be happy to feature it. It is supposed to be fair and simply outline the differences in features.
- pixelpoet 2y agoFor one thing, C3 thankfully understands that there are more mathemathical types people are interested in than just ints and reals, for example vectors: https://c3-lang.org/language-common/vectors/ https://c3-lang.org/language-common/vectors/ Zig has SIMD vectors, but I frequently need 3D vectors, and refuse to use things like vec3_add(vec3_mul(a, 2), b) etc since I mainly develop 3D graphics software.
- zem 2y agointeresting example of swizzling ``` int[<3>] a = { 11, 22, 33 }; int[<4>] b = a.xxzx; ``` I assume that the `xxzx` is translated directly by the compiler. not seen that in any other language though ruby can fake it pretty easily via `method_missing`
- bsder 2y agoIn Zig, basic operations on vectors with standard operators work fine. "+", for example. const meta = @import("std").meta; test "vector add" { const x: @Vector(4, f32) = .{ 1, -10, 20, -1 }; const y: @Vector(4, f32) = .{ 2, 10, 0, 1 }; const z = x + y; try expect(meta.eql(z, @Vector(4, f32){ 3, 0, 20, 0 })); } Everything is element-wise, which matches what the shading languages do (mostly). But, yes, you won't get overloading allowing things like dot, cross, or scalar products. And I do miss the swizzle notation, but I don't think the language actually prevents that so it might appear at some point.
- lerno 2y agoAs the author, let me add something beyond the comparison. Zig and Odin are very different languages, Odin is – as its slogan goes - "for the Joy of Programming". Zig on the other hand doesn't feel that this is a goal. From what I can tell Zig fans like to wrestle with the features of Zig to figure out how to fit their solutions within the constraints of the language. A mental challenge, similar to that of fighting the borrow checker in Rust. People who "figured out" Zig tend to be fiercely loyal to the language in a similar way as Rust evangelists to Rust. C3 has a lot in common with Odin, but very little in common with Zig. C3 has a slightly different feature set than Odin (e.g. more compile time execution, has methods, contracts, but doesn't have Odin's matrix programming and more extensive runtime reflection), but the goals aligns strongly with Odin's. If you prefer C syntax and semantics you might like C3 better, but Odin is a fine language too.
- judofyr 2y ago> People who "figured out" Zig tend to be fiercely loyal to the language in a similar way as Rust evangelists to Rust. This is very much not productive and you’re now part of spreding this narrative. There’s plenty of people out there who has «figured out» and appreciate both Zig and Rust without becoming attached to it. I’m interested in communities which looks towards other languages for inspiration and admiration, not judgements and alienation.
- unclad5968 2y agoSo which language do you use then? I've never seen a language that doesn't have bad things to say about other languages. Zig bdfl himself accused vlang of committing fraud a while back. Every language designer takes things they like about some languages and leaves things they don't like.
- wk_end 2y ago> Zig bdfl himself accused vlang of committing fraud a while back. I think there's a difference between a critical generalization of a community and the mindset behind it and how that relates to the language (without weighing in on how legitimate that criticism is), and a direct accusation that one individual did a specific bad thing.
- fuhsnn 2y agoZig and Odin compiler may implicitly pass variables by references[1][2], creating hidden aliasing, that's one thing unacceptable for me coming from C, I haven't read about C3 doing this, hopefully it doesn't and not planned in the future. [1] https://www.1a-insec.net/blog/25-zig-reference-semantics/ https://www.1a-insec.net/blog/25-zig-reference-semantics/ [2] https://github.com/odin-lang/Odin/issues/2971 https://github.com/odin-lang/Odin/issues/2971
- lerno 2y agoC3 follows the C ABI, so no it doesn't do it and it's not planned.