Live data from Hacker News

Does C++ still deserve a bad rap?

nibblestew.blogspot.com

191–200 of 310 posts

Re: Does C++ still deserve a bad rap?

#191

Serious question to those in the gaming industry: I heard C++ is mostly dominant there, can any other language even be considered for writing a game engine in? For serious AAA titles?

There are two studios that are working on significant big projects in Rust, Ready At Dawn and Embark. We'll see!

(There are of course a number of non-AAA games too, but since you asked about that specifically...)

Re: Does C++ still deserve a bad rap?

#192

C++ is a very poorly designed language. A lot of the work being done by the committees is fixing Stroustrup's mistakes. Consider horrors such as this. In the following statement what are foo and bar? int x = foo(2) + bar(3); Most people will say foo and bar are functions and that's a reasonable guess. Unless you are talking about C++. In C++ foo and bar could be functions but could also lots of other things. For exam…

Thanks to macros foo(2) can be litterally anything in awesome C.

Re: Does C++ still deserve a bad rap?

#193

I have nothing against C++ per se. Used it on and off for 10 years (but most actively 3). It's a fine language. To me using C++ means you are ready to give up a lot of time and energy in order to gain a complete control over certain aspects of your program. I was very much into that at the start of my career and gradually started drifting away to more immediate productivity while reserving the right to poke under the…

I find it very interesting that you put Haskell in one camp, and OCaml into the other. I am more of a Standard ML guy instead of OCaml, but can you elaborate a bit why you feel you can iterate faster in OCaml than in Haskell?

OCaml is quite a lot more pragmatic and 'loose' than Haskell. But that's just my impression. They even have for-loops in OCaml..

(I would be really slow writing code in vanilla JavaScript. There's no static checking, and not much dynamic checking. So you need to watch your step very carefully---in some sense, very much like in C++.)

Re: Does C++ still deserve a bad rap?

#194
post #164

I have nothing against C++ per se. Used it on and off for 10 years (but most actively 3). It's a fine language. To me using C++ means you are ready to give up a lot of time and energy in order to gain a complete control over certain aspects of your program. I was very much into that at the start of my career and gradually started drifting away to more immediate productivity while reserving the right to poke under the…

What are the cases where you would use specifically Ocaml instead of C++ or Rust?

(EDIT: I misread your question, apologies. OCaml vs. C++ is mostly because of much less surprises to start working with it. OCaml vs. Rust is mostly because Rust mandates you to pay attention to a lot more initially (`Result`-s being a prominent example, although using `.expect()` or `.unwrap()` actually helps a lot) and even if I absolutely love that you have to iron-proof your code, it does get in your way when you just want to try something quickly. It kills the motivation intrinsic to the flow state.)

---

(Original reply:)

I'll admit it's not a factual and clear-and-cut distinction.

OCaml has warts (no multicore, although that's claimed to be very close to complete now; also no UTF-8 strings by default, and a somewhat surprising tooling, the first time at least) but I found Haskell to ask too much of me to even start -- I almost immediately grokked monads and lazy evaluation but it seemed to be too much effort for something you'd like to quickly play with. And when I saw the list of all compiler variants I almost gave up right there and then.

OCaml, as mentioned in the parentheses above, isn't without problems too but I found that I could get to a working dev stack and the ability to make a quick program and run it, much quicker compared to Haskell. Also, it's very terse.

Not the most compelling or factual of reasons but this is how I arrived at that place where I prefer OCaml for sketching ideas and not Haskell.

Re: Does C++ still deserve a bad rap?

#195

I have nothing against C++ per se. Used it on and off for 10 years (but most actively 3). It's a fine language. To me using C++ means you are ready to give up a lot of time and energy in order to gain a complete control over certain aspects of your program. I was very much into that at the start of my career and gradually started drifting away to more immediate productivity while reserving the right to poke under the…

I find it very interesting that you put Haskell in one camp, and OCaml into the other. I am more of a Standard ML guy instead of OCaml, but can you elaborate a bit why you feel you can iterate faster in OCaml than in Haskell?

Check my reply in another comment that's sibling to yours.

Re: Does C++ still deserve a bad rap?

#196

I have nothing against C++ per se. Used it on and off for 10 years (but most actively 3). It's a fine language. To me using C++ means you are ready to give up a lot of time and energy in order to gain a complete control over certain aspects of your program. I was very much into that at the start of my career and gradually started drifting away to more immediate productivity while reserving the right to poke under the…

I love this concept! I think it's more linked to experience than anything specific language feature. I used to think it was typing, then I became more proficient in Haskell and the type system actually saved me time. My in-the-flow languages right now are Haskell, JavaScript and PHP, but I'm trying to add rust to it. I have a friend who reaches out to C for quick prototyping. I know many more going for .Net or Java (…

I am still having a hard time adding Rust to my flow-state-coding. Sadly, like C++, it does require you to learn quite a bit before that point.

But I still find it more pleasant than C++ so I reach for Rust instead. Plus the experience really starts to pay off from one point and on.

Re: Does C++ still deserve a bad rap?

#197
post #57

Earlier quoted context omitted.

Do you know if they're revisited this ever since string_view was implemented? I feel like a vector should be quite uncontroversial, and you could even propagate the allocator from the string to the vector.

Since they now have ranges, the discussion can start all over... But I'm maybe no completely up to date, where the discussions is.

With range it would be

    auto splitText = text | view::split(' ') | ranges::tostring>>();

Re: Does C++ still deserve a bad rap?

#198

I have nothing against C++ per se. Used it on and off for 10 years (but most actively 3). It's a fine language. To me using C++ means you are ready to give up a lot of time and energy in order to gain a complete control over certain aspects of your program. I was very much into that at the start of my career and gradually started drifting away to more immediate productivity while reserving the right to poke under the…

I general I agree with your broader point about when to select dynamic language, flow state etc., and specifically with C, C++, Rust (although of those I haven’t done C++ in years except to tweak others’ code). However I find D can be written in a very script like manner, using the GC. Only when chasing performance do I need to go GC-free. The fast compilation means I can iterate as fast as python, and it has replace…

Check here: https://news.ycombinator.com/item?id=24809623 (sibling comment).

Re: Does C++ still deserve a bad rap?

#199

Earlier quoted context omitted.

I used to work with C++ almost exclusively, but accepted to use more interactive languages for most of my work mostly for faster iteration. C++ is definitely not my main choice anymore, but still use it daily. C++ has pretty much unmatched tooling due to the massive ecosystem. I have my own long list of gripes against it's syntax and historical baggage, however it's a language that doesn't really impose a style/idiom…

What is "static compilation"?

[deleted]

Re: Does C++ still deserve a bad rap?

#200

I have nothing against C++ per se. Used it on and off for 10 years (but most actively 3). It's a fine language. To me using C++ means you are ready to give up a lot of time and energy in order to gain a complete control over certain aspects of your program. I was very much into that at the start of my career and gradually started drifting away to more immediate productivity while reserving the right to poke under the…

I general I agree with your broader point about when to select dynamic language, flow state etc., and specifically with C, C++, Rust (although of those I haven’t done C++ in years except to tweak others’ code). However I find D can be written in a very script like manner, using the GC. Only when chasing performance do I need to go GC-free. The fast compilation means I can iterate as fast as python, and it has replace…

OCaml and Haskell share a common ancestry, but I would also draw a distinction between them. (Though not the same that the other commenter did.)

OCaml is a bit more of a drop-in replacement for something like C++ or D. Mostly because it's strict by default, so it's easier to reason about performance even for a non-expert user.

OCaml's approach to side-effects has now entered the mainstream: it's considered good style to avoid them, but they are still used pervasively. That's very similar to what good modern C++, Java, Python etc style advocates.

Of course, Haskell also allows side-effects. But generally, you track that they are occurring with the type system, you generally stick them in some kind of Monad or Applicative Functor.

Post reply on HN