3 ms·
One of my recurring language design hot takes is that it's easier to design for speed and then make it easy to use than it is to make it easy to use and then tr
by estebank 7mo ago
One of my recurring language design hot takes is that it's easier to design for speed and then make it easy to use than it is to make it easy to use and then try to speed it up.
- coliveira 7mo agoC++ is trying to make C easier to use for 40 years, and it's still not there. So I wouldn't call that easier.
- astrange 7mo agoC++ is trying to make something EASIER to use?
- anthk 7mo agoC++ if any made C user friendly.
- jcelerier 7mo agohow would you write something like #include <print> #include <map> #include <string> int main(int argc, char** argv) { using namespace std::literals; std::string foo = "foo:"; foo += argv[0]; std::map<std::string, int> m{ {foo, 123} , {"count: "s + std::to_string(argc), 456} }; std::println("{}", m); } in C
- hackyhacky 7mo agoSure, there are nice parts of C++. And there are also brain-dead parts that add needless complexity such as: * rvalue references * the difference between auto, decltype, typeof * unreadable template monstrosities * various different flavors of "smart" pointer * the continued existence of footguns relating to UB, dangling pointers, unexpected temporary lifetimes, etc * total absence of a build system or package management * legacy APIs that still take raw pointers * concepts, a half-assed attempt at generic constraints
- pjmlp 7mo agoNo worries, you get some of those in C23, and C2y. Where is C's build system and package management? Yeah, because using _Generic alongside typeof and preprocessor macros isn't half-assed attempt at generics.
- hackyhacky 7mo agoYou misunderstood. Perpetuating C's weaknesses, and then adding additional complexity, is not a defense.
- pjmlp 7mo agoIt kind of is, when the goal was to be TypeScript for C, before this was even a concept. Now ideally we would all be using Modula-2, Ada, Delphi, VB, C#,.... and co, but given that even C compilers are nowadays written in C++, we make do with what we have, while avoiding C flaws as much as possible.
- deleted 7mo ago[deleted]
- pjmlp 7mo agoEven better example, import std; int main(int argc, char** argv) { using namespace std::literals; auto foo = "foo:"s; foo += argv[0]; std::map<std::string, int> m{ {foo, 123} , {"count: "s + std::to_string(argc), 456} }; std::println("{}", m); }
- pjmlp 7mo agoIt has been there for me since 1993, in every single scenario as alternative to C, when the choice boils down to either of them. Since 1993, I only have used C when required to do for various reasons out of my control, or catching up with WG14 standards.
- raincole 7mo agoExamples?