|
|
Log in / Subscribe / Register

DeVault: Announcing the Hare programming language

DeVault: Announcing the Hare programming language

Posted May 2, 2022 4:07 UTC (Mon) by areilly (guest, #87829)
In reply to: DeVault: Announcing the Hare programming language by atai
Parent article: DeVault: Announcing the Hare programming language

Or zig, if you want to do without Rust's memory safety efforts. At least zig allows about the right amount of compile-time metaprogramming. I couldn't see any mechanism for macros or compile-time expression evaluation.

The only really astonishing thing that I saw in the tutorial and standard library documents, or rather didn't see, was any mention of threads, parallelism or asynchronous operation. Aren't we about ten years too late for another strictly single-threaded language?


to post comments

DeVault: Announcing the Hare programming language

Posted May 2, 2022 7:20 UTC (Mon) by pbonzini (subscriber, #60935) [Link] (8 responses)

Yes, Zig is really interesting as a better C. The only downside is that it basically needs whole-program compilation due to how error sets work, but the feature set is impressive and I think C should borrow learn a lot from it.

DeVault: Announcing the Hare programming language

Posted May 2, 2022 13:10 UTC (Mon) by ncm (guest, #165) [Link] (7 responses)

Yet, Zig also has no legitimate claim on our attention. Both are weak-sauce alternatives that do none of the heavy lifting a modern language provides.

DeVault: Announcing the Hare programming language

Posted May 2, 2022 15:28 UTC (Mon) by pbonzini (subscriber, #60935) [Link] (2 responses)

I don't think Zig or Vala have any shot at being a major contender. However there is a lot of legacy C code that won't reasonably be converted to C++ or Rust, and in my opinion Zig is a pretty good experiment as to how C could grow to incorporate new features (compile-time metaprogramming, coroutines, etc.) that those legacy projects could use.

DeVault: Announcing the Hare programming language

Posted May 2, 2022 18:17 UTC (Mon) by bartoc (guest, #124262) [Link] (1 responses)

zig suggests that there is an interesting and fruitful design space enabled by not doing implicit instantiation of generics (I think c++ got implicit instantiation _almost_ by accident because of the way cfront worked, but that was before my time)

DeVault: Announcing the Hare programming language

Posted May 2, 2022 19:40 UTC (Mon) by mathstuf (subscriber, #69389) [Link]

Having to explicitly instantiate templates may certainly have put the kibosh on some of the ridiculous template metaprogramming I've seen in C++. However, I suspect it would have been used anyways because when a language only gives you a limited set of tools and the best thing for turning that screw is a scissor blade, by gosh, someone is going to use that scissor blade. Whether oodles of compiler output when you hold it wrong or gigantic TUs of template instantiations is worse is up for debate.

DeVault: Announcing the Hare programming language

Posted May 2, 2022 15:59 UTC (Mon) by atnot (guest, #124910) [Link] (3 responses)

Come on, that's a bit far. Zig has plenty of things to offer, most importantly excellent no-bindings interoperability with C and C++, interesting approaches to async and more comprehensive compile-time evaluation and metaprogramming than any other native non-research language I'm aware of. Rust's C interop and macros look primitive and poorly integrated in comparison.

It's not transformative, sure, and I'm not sure I would start a greenfield project in it today. It definitely sacrificies more robustness for it's great C-compatibility than I'm personally comfortable with. But it's a compelling option for people with existing C codebases or complex C libraries and contributes some genuinely new and interesting approaches to writing expressive low level code. It's very far from being just an 80s nostalgia roleplay language.

DeVault: Announcing the Hare programming language

Posted May 2, 2022 23:37 UTC (Mon) by roc (subscriber, #30627) [Link] (2 responses)

Zig has excellent interop with *C++*, really? I don't see that.

DeVault: Announcing the Hare programming language

Posted May 3, 2022 0:07 UTC (Tue) by atnot (guest, #124910) [Link] (1 responses)

Perhaps I shouldn't have mentioned C++ considering the advantages are less apparent there (or arguably it is even behind compared to bindgen and cxx's capabilities).

But either way, there's a lot more to compatibility than just understanding the language constructs. A lot of existing C and C++ code, unfortunately, has very unclear data ownership and mutability. Trying to wrap that in a language with much different and stricter memory semantics is usually a pretty bad time. I have given up on it multiple times before. So while Zig may not understand C++ headers (yet?), I do think it's already much closer to working well with it by default.

DeVault: Announcing the Hare programming language

Posted May 3, 2022 11:00 UTC (Tue) by tialaramex (subscriber, #21167) [Link]

In modern C++ you're going to have a lot more cases where ownership is represented via a smart pointer (std::unique_ptr or std::shared_ptr), which is something Rust can get behind easily, but Zig can't really help you with. So it's probably going to shade over, C++ code that's mostly 15-20 years old may be happier to work with from Zig, while C++ code that's all written after say C++ 14 might be much easier to work with from Rust via one of the C++ FFI libraries like cxx which understands the standard library smart pointers.

DeVault: Announcing the Hare programming language

Posted May 31, 2022 0:05 UTC (Tue) by federico3 (guest, #101963) [Link]

Why Zig when you can use Nim?


Copyright © 2026, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds