Earlier quoted context omitted.
lol thats not a c++ problem. Cpp is different lang than python. If u don't have experience with c++ stop complaining about it. And regarding developer experience it doesn't matter if end consumer are going to get slow bloated app which need python runtime to be installed lol.
I do have experience. It's my main language and my current job. C++ really sucks to work with for a developer even with types. For building cloud services where apps are bottlenecked by the database, the user experience is roughly the same as C++ but the developer experience with python is much much much more easier. This attitude where consumers have to run the apps or install a runtime to run the app on there perso…
Does C++ still deserve a bad rap?
211–220 of 310 posts
Re: Does C++ still deserve a bad rap?
#212Like every programming language out there, C++ is a tool. And like every tool out there it has its uses. There isn't any point of using C++ to count words in a text file. Any high-level language like Python will beat you to it. However, there's one thing you can do in C++ and not in Python or JavaScript or PHP: fully control the memory layout of your data. While you don't need it in most of the cases, it becomes a ki…
From memory, a thing i've implemented in C++ that its basically impossible in almost any other languages (with few exceptions). Represent a data table in memory where the columns are from different types, where the data is backed by a arena allocator and represented contiguously in memory. Of course you can do a data table representation in almost any language, but once you benchmark the implementations, the language…
Re: Does C++ still deserve a bad rap?
#213Re: Does C++ still deserve a bad rap?
#214Earlier quoted context omitted.
The second case is easily solved by having an overload operator+(complex lhs, int rhs). No need to convert anything.
complex c = 4; Would you rather have this line not compile because 4 is not a complex number? Because one _could_ argue that 4 is a complex number, and C++ can represent this with an implicit constructor. The issue with C++ is that implicit is the default, not that it exists.
If your data type implements the Num typeclass, you can use literals like 4. (A typeclass in Haskell is similar to what they call an interface in Java.)
There's no automatic conversion happening at all. It's done via overloading literals at compile time. (You can do the same for strings.)
Re: Does C++ still deserve a bad rap?
#215Earlier quoted context omitted.
> This slightly over 100 page book on move semantics https://leanpub.com/cppmove shows some of the iceberg like complexities dotted all over the place. Some developers probably never use and have never even heard of move semantics. I think Scott Meyers' "Effective Modern C++" which is in large part a collection of caveats and description of things which don't fit always together also underlines that impression: https…
Hard agree. I was enthusiastic about reading that book when I got it, as I'd been very late to the bandwagon of new C++11 and C++14 features. Ended the book in a pessimistic tone. It looked more like a cookbook of pitfalls _everywhere_. Every new feature looked exciting, but came with a list of cases where the language decides to leave you on your own when it gets too uncomfortable (the "well that's undefined behavio…
Also let me use this comment to recommand John Lakos, his talks, his books. He knows how to build large scale applications and if you saw his talk on the 'is_working_day' function (if I remember correctly) you know you were not overthinking.
Re: Does C++ still deserve a bad rap?
#216The issue with C++ is that it's unsafe by default. Foot-guns abound. The right way is to make everything safe by default and provide an escape hatch when needed, e.g. Rust's unsafe or C#'s unmanaged.
Unfortunately, there's no way to "fix" C++ to be safe-by-default. Too much legacy code out in the world and no appetite in the standards committee for backwards-incompatible changes in future versions of the standard.
It seems obvious to me that e.g. C++2X should entirely drop some older, broken, unsafe concepts, e.g. auto_ptr is the first thing that comes to mind, but there's all kinds of gnarly bits that need to go, and just allow older code to continue compiling under previous versions of the standard.
That does leave libraries in a tough place - if your project wants to move to the (never going to exist) backwards-incompatible C++2X, they would need to update or remove all libraries not compatible with the new version.
But this seems like a way to eventually move the entire ecosystem to a better place. Possibly the only way.
Re: Does C++ still deserve a bad rap?
#217My beef with C++ is with its dependency (non)management. For almost every modern language, you can easily build and run code - pull code from repo, run the included script or standard command to get the dependencies and build it, bam, you're done without needing to know much about that language. With C++ it seems like half of the time pulling someone else's old project from github and running make (or whatever the au…
Re: Does C++ still deserve a bad rap?
#218“There are only two kinds of languages: the ones people complain about and the ones nobody uses.” Bjarne Stroustrup
(Not quite _every_ way: lack of per-container allocators, and less advanced generic/metaprogramming facilities are two particular pain points)
Re: Does C++ still deserve a bad rap?
#219Earlier quoted context omitted.
OCaml is a much smaller language than Haskell. Similarly, Erlang (and thus Elixir, I guess) is also comparatively small and simple. Surprisingly, C would be in the same category, if it wasn't so primitive and likely to make you shoot yourself in the foot. I've programmed professionally in both OCaml and Haskell (and Erlang and C etc). I find that Haskell is generally more terse than OCaml. They are both fine language…
Interesting how different experiences with the same thing can be! :) > it helps to have some people around who know what they are doing I think that's the crux of my issue. OCaml wasn't the easiest to start with either but it took me 2-3 casual evening sessions to just be able to sketch code and run it immediately with almost no hassle. But yeah, can't deny Haskell kind of rubbed me the wrong way so I am likely biase…
It's been a few years since I last did OCaml. At that point, the ecosystem was a bit more mature for Haskell. More libraries, better editor support, etc.
In some platonic sense I like small languages, but I had come to appreciated all the extra comfort Haskell provides. OCaml was just too much in the uncanny valley of being almost Haskell, but then missing some nice-to-haves. I might grumble, but OCaml is a pure pleasure compared to C++.
Btw, they finally added (optional) stacktraces to Haskell a few years ago.
About all the language extensions in Haskell: I like them, but they can be overwhelming. Luckily, the language extensions your libraries use has almost never any bearing on what language extensions your client code uses.
So you can ignore the extensions, and still use your favourite libraries.
Re: Does C++ still deserve a bad rap?
#220Modern C++ can be a joy to write, and is fine for a lot of tasks. It's hard to beat the combination of performance characteristics and higher-level constructs. The issue with C++ is that it's unsafe by default. Foot-guns abound. The right way is to make everything safe by default and provide an escape hatch when needed, e.g. Rust's unsafe or C#'s unmanaged. Unfortunately, there's no way to "fix" C++ to be safe-by-def…