9,664 karma · joined Jun 14, 2010 (16y ago) · 1,504 submissions
comment 5y ago · link · parent
But on the other hand, my instinctive reaction is: Come on, is this really something that confuses people? emplace_back is all about constructing something in-place, which is exactly the opposite of moving it there! How can any professional programmer be 180 degrees wrong about the purpose of a function they use regularly?
What I want to say here is that C++ is really hard, and that there are a million subtle things that one simply has to look up instead of making educated guesses. I don’t think people appreciate this difficulty enough.
comment 5y ago · link · parent
Do you know if these are really meaningful shortages, or if businesses have just kept the signs up to make people feel taken care of?
comment 5y ago · link · parent
What I meant is: There was no reduction in overall toilet paper production, and people didn't suddenly start to shit more. The shortage was mostly a distribution/packaging issue in the form of "not available in packaging X at location Y". Markets tend to solve that kind of problem incredibly quickly.
comment 5y ago · link · parent
Still, supermarkets could have temporarily raised prices 10x and still sold their inventory. Why didn't more of them do it? Presumably, they made the rational calculation that the bad reputation they'd get from such a move would outweigh any short-term profits.
comment 5y ago · link · parent
comment 5y ago · link · parent
Godot usually gets a lot of praise of HN and elsewhere, probably rightly so. But I got the same weirdly defensive vibes from reading the article. Performance is the strawman used throughout: claiming you don't need that many objects anyway, claiming that there design is "higher level" -- without ever really explaining what that means. I know from other contexts that the real problem with deep inheritance hierarchies often is code duplication, you simply can't solve the diamond problem. Good job pointing out examples of that.
comment 5y ago · link · parent
However, React introduces a lot of complexity to avoid unnecessary DOM updates, which makes me wonder about the viability of an immediate mode GUI in the browser using canvas.
comment 5y ago · link · parent
Hmm, as far as I understand the math, your palette being pure colors shouldn’t really matter if the display calibration were perfect. Which I guess is an unrealistic expectation. :)
comment 5y ago · link · parent
Also, one civilization dominating wouldn’t mean that the other one would magically disappear. As a simple assumption, I can imagine the stronger civ expanding into the territory of the weaker one relatively unhindered (in terms of expansion speed). But the weaker civ would still expand outwards as well. If it’s expansion speed isn’t slower, it would continue to grow in absolute size.
comment 5y ago · link · parent
How relevant is x86 code in terms of security? Genuine question. I thought Firefox defaults to x86_64 now even Windows. And in open source land, wouldn’t any OS components that could be compiled with Clang be x86_64 as well?
comment 5y ago · link · parent
comment 5y ago · link · parent
comment 5y ago · link · parent
(BTW, bindgen hasn’t changed that much. The expectation seems to be that people write a safe wrapper around the generated bindings anyway, so not a lot of effort goes into making them maximally convenient. I also don’t find that ideal.)
comment 5y ago · link · parent
At least at the moment, Rust's many features are mostly orthogonal and work well in combination. But in some sense, that makes the learning curve even harder, because you can't focus on an "accepted subset" as you would in an existing C++ codebase.
comment 5y ago · link · parent
Point by point:
- No hidden control flow: Linus Torvalds used to argue for C over C++ for similar reasons. I think it's a valid point for some kinds of systems programming. IMO, the argument is a lot stronger for features like destructors (C++) or Drop (in Rust) because those are truly hidden. At least the + sign is visible, and experienced C++ devs read it as a function call anyway.
- No hidden allocations: This is just a library design choice in C++ and Rust, not baked into the language. The standard libraries of those languages usually favor convenience over the last bit of flexibility and performance. At least in the case of C++, there's an ecosystem of libraries like the EASTL that make different choices.
- No standard library: That's fully supported in common C++ compilers and Rust. If Zig goes beyond what those languages offer, which it might, then the article should probably explain how.
- Error handling: "Zig is designed such that the laziest thing a programmer can do is [...] properly bubble errors up." That's also true for exceptions. Presumably, Zig doesn't have exceptions. This could be explained, and contrasted with Rust's monadic approach to error handling.
- Compatibilty with C: That doesn't tell me much, because C++, D and Rust all have excellent C compatibility.
- Package manager: Great! Both Rust and D also have one, so this might mainly be a point in contrast to C++?
- No metaprogramming: I looked up how Zig treats format strings. It looks like it's possible for functions to have "compile time arguments", and there are some rules around compile-time evaluation of if statements and inlineable loops [1]. At first glance, there might be some parallels to D's metaprogramming capabilities, which also has static ifs and loops, but I don't know if that mechanism is as powerful. It certainly looks elegant, but to me, it clearly is a kind of metaprogramming, not "no metaprogramming".
Having said all this, I'm very happy that there are more languages in this space now.
Maybe at this point, the best strategy for a project like Zig is to address Rust head-on in comparisons like this. It's very unlikely that someone reads this article in 2021, is looking for a new systems language and isn't also considering Rust.
[1] https://ziglang.org/documentation/master/#Compile-Time-Expre...
comment 5y ago · link · parent
#![warn(clippy::all)]
at the top of your crate’s entrypoint. This enables Rust’s default linter. It’s a lot more friendly and focused on good design than you might expect, often suggesting more elegant alternatives. Plus, many of its suggestions can be applied automatically in an environment like VS Code + rust-analyzer plugin.comment 5y ago · link · parent
comment 5y ago · link · parent
Do these differences really matter, or is it mostly just the timing?