4 ms·
From the slides, these bullets struck me as things I have wanted for a while (to the extent that I have my own toy language that addresses some of them): - com
by gavanwoolery 8y ago
From the slides, these bullets struck me as things I have wanted for a while (to the extent that I have my own toy language that addresses some of them):
- compiles faster than C
- Produces faster machine code than C
- Seamless interaction with C libs
- robust/ergonomic error handling
- Compile-time code execution and reflection
- No hidden control flow
- No hidden memory allocations
- Ships with build system
- Out-of-the-box cross compilation
- Yoric 8y ago> - No hidden control flow That means no destructors, right? edit Ah, if I read the documentation correctly, there are destructors.
- nickez 8y agoI think it means no exceptions
- iainmerrick 8y agoI think it means no destructors, no overloaded operators, no automatic getter/setters for properties. Nothing that does a function call unless you can immediately tell by looking at it that it’s a function call.
- MaxBarraclough 8y agoYou're right - there's no proper RAII (but there's a 'defer' keyword, which runs your expression on scope-exit, like BOOST_SCOPE_EXIT), no operator overloading, no exceptions, and all function calls look like function calls. It does have a language feature for handling error-codes though. [0] [1] [2] Contrast with C#'s 'properties', where a method call (which might throw) is disguised as reading/writing a member. My favourite example of unexpected semantics is D's lazy keyword, where, at the call-site, you have no idea whether your argument will be evaluated lazily or eagerly! [3] C# has a pass-by-reference keyword which modified the way an argument is treated, but it has the sense to force use of the keyword at the call-site too, so that everything is clear. [4] I like the language's philosophy, I'll have to keep an eye on it. I suspect they'd do well to have the language compile to C, though. Is there any reason that wouldn't be a good fit? I see it has a templates system, but at (very) first glance I don't see anything that wouldn't map cleanly to C. [0] https://ziglang.org/documentation/master/#defer https://ziglang.org/documentation/master/#defer [1] https://ziglang.org/download/0.1.1/release-notes.html https://ziglang.org/download/0.1.1/release-notes.html [2] https://andrewkelley.me/post/intro-to-zig.html https://andrewkelley.me/post/intro-to-zig.html [3] https://dlang.org/articles/lazy-evaluation.html https://dlang.org/articles/lazy-evaluation.html [4] https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/keywords/ref#passing-an-argument-by-reference https://docs.microsoft.com/en-us/dotnet/csharp/language-refe...