3 ms·
https://ziglang.org/learn/why_zig_rust_d_cpp/ https://ziglang.org/learn/why_zig_rust_d_cpp/
by faraaz98 4y ago
https://ziglang.org/learn/why_zig_rust_d_cpp/ https://ziglang.org/learn/why_zig_rust_d_cpp/
- peoplefromibiza 4y agohonestly this does not contradict the claim that D is equally powerful, if not more powerful, than Zig. It is, at least, more battle tested.
- henry_viii 4y agoSome of the arguments listed in the page are misleading: > Zig is a programming language, but it also ships with a package manager Which is not true: https://github.com/ziglang/zig/issues/943 https://github.com/ziglang/zig/issues/943 > Zig has no macros and no metaprogramming Literally from Zig's homepage (https://ziglang.org/ https://ziglang.org/): "Comptime - a fresh approach to metaprogramming" The rest of the arguments are very weak in my opinion.
- G4E 4y agoEven the first argument "no hidden control flow" is disingenuous : either the object you are summing are complex and you have to call a custom function to define what "summing" means in that case (you need to provide the summing function), or those are a primitive type and you're just calling a function builtin the language itself. In every case, you are calling a function ...
- tosihakkeri 4y agoDon’t you people have anything better to do?
- messe 4y ago> or those are a primitive type and you're just calling a function builtin the language itself You’re thinking at a different level of abstraction to the Zig developers. Summing a primitive type is going to be turned into a couple of machine opcodes (but no branch instruction) and will usually be constant time, whereas an explicit function call will require pushing pc to the stack and jumping elsewhere, executing any number of instructions once there, taking an arbitrarily long time, making it more difficult to reason about.
- mh7 4y agoDoes zig plan on not supporting microcontrollers or not using "/" for integer division? Because on your typical arm mcu, x/y is a function call to a definitively non-constant time function. And lets not forget soft-fp. Every single floating point op is a function call...
- defen 4y agoA better way to think about it is: for a given line of code, how much context do you need in order to understand what function is actually going to be called? Yes, some compiler-rt or soft-fp function might get called but you know that's happening and what it does. With most languages you need significantly more context than you do in Zig - in C you need to know what preprocessor shenanigans might be going on; in C++ pretty much anything could be happening (operator overloads, virtual functions, constructors, destructors, who knows what else). With Rust you need to know what traits are imported, and if proc macros are involved then anything goes.
- dom96 4y agoFWIW regarding the package manager, based on the rest of the text my guess is that whoever wrote this intended to say that "Zig will ship with a package manager". I created https://github.com/ziglang/www.ziglang.org/pull/228 https://github.com/ziglang/www.ziglang.org/pull/228 let's see if it gets accepted :)