C++, Rust, D and Nim

Can we have a mature discussion about these languages for once?

>C++
I have been using C++ for the past 4-5 years, but I was never fully contempt with the language. The C++17 brought a few niche features to the table but I am eyeing on the much anticipated C++20.
However due to backwards compatibility C++'s modules won't catch up soon. C++ will never be able to standardise dependency management.


>Rust
Well, I tried studying Rust for a couple of months. I think the language would have a much brighter future if it had somewhat decent standard library. For example, there is no standard date-time library in Rust!
Rust is a completely new paradigm, and it adds mental overhead whenever you try and implement your data structures since you are not used to lifetimes, ownership and borrow checking (LOB). The language is FULL of LOB pitfalls which makes me think its not a well thought out language. However the language is constantly evolving which is a good sign. You get to have higher level features at the cost of no GC, objects' borrow checked at the compile time.

>D
D is a very mature language. D is like using a better C++ with few features added, a few features removed and there's a subpar GC. You can disable it but you would rather not. It's a massive language, and like C++, it's burdened with historical mistakes (for example: Object methods/no base classes).
I would not mind if D3 comes up and learns from the mistakes it made. But that's not going to happen.

>Nim
On surface it looks cute but deep down its a hell of templates. Thankfully its all hygienic macros. I have high hopes for nim but the creator thinks pascal casied name should be aliased with snake cased names. Doesn't look like it's going to do well in the battle of time.

What does Sup Forums think of these languages?

the latter 3 aren't used in the industry

Out of the 4 you listed, C++ is the only one that’s really used in industry right now. Rust has some hype around it but it needs some time to mature. The other two are too niche for anything other than hobby projects.

There’s also Crystal which is sort of in the same state as nim, both need corporate backing to be viable long term imo.

>C++
Way too verbose. It's so difficult to learn. Searching for updated resources on learning this is nearly impossible, save for language specifications/references, which you probably won't understand if you're a beginner. If you know C, it's probably even harder to learn/understand. People tell you to just type things, but they never tell you what it actually does. So much for zero-cost abstractions, when you don't know what those abstractions are for or have a rought idea of how they work. Still, it's probably the only language right now that can do most of the things I want to do.

>Rust
Have pretty high hopes for this one. It has an interesting memory model. Still can't into the language as a whole though. Runtime bounds checking is probably not zero cost. As far as I know, there's no way to turn it off for when you know shit can't possibly be ever outside the array. Also, it's missing features things like CTFE and native SIMD which are pretty easy to use in other languages. Syntax-wise, I really hate that they dropped the ?: operator, but, whatever, it's only my preference.

>D
Don't know much about this one. The GC does put me off, but there's all these claims about how it's possibly to program with it turned off.

>Nim
Also don't know a lot about it, aside from it compiling to C. It also feels like it will remain an esoteric language. D (if I recall correctly) is getting accepted in gcc, but even then, It feels like a language no one uses.

I've heard of programs in Rust like terminal emulators, windows managers on wayland, etc. I've never used them, so I don't know how good they are, but I've never heard of projects in D or Nim. To be fair, I do note that Rust seems hyped up by the community.

Right now, I'm still sticking to C and learning about stuff other languages do, but again, learning resources for C++ is a huge ass barrier, and Rust is interesting, but probably not that much better. I haven't decided between the two.

>Searching for updated resources on learning this is nearly impossible, save for language specifications/references

There are plenty of excellent beginner/advanced books for C++ to get you going, search for C++ Primer (5th ed) for C++11 for example.

The biggest mistake people usually make right at the beginning is to treat C++ like it was C with some extra candy, and the same coding style. It's not, and the good books will teach you why.

>C++ is hard to learn because there is many things in the language
I often see this, but I don't find it accurate.
You can learn enough c++ to solve problems in a semester.
Obviously you need to know more if you want to do something worthwhile with it.
A good example is the eigen library. It doesn't take much to learn how to include it and reading the documentation makes everything very clear how stuff works.
But you cannot use it unless you already know the math behind it.
The same goes for the STL, you need to know about data structures.
This is why I think learning C++ is learning programming. You can easily use a different language once you have learned C++. But if you were never confronted with these concepts, C++ can be very hard to grasp.

Abandon these languages and join the functional master race.

You can do access without bounds checking in Rust with unsafe functions. But most of the time if you are accessing stuff with indices instead of using iterators you are doing it wrong

>Also, it's missing features things like CTFE
Nightly Rust has const fn but it's extremely gimped compared even to something like constexpr.

OCaml master race

Going a bit tangent,
I like MATLAB
It's not a very good programming language but the matrix operators and logical indexes are pretty useful.
I like the GUI too
You can easily convert it to C and C++ too

My problem is not really with the syntax, but with the abstractions. I know modern C++ is very different from C. What I'm talking about is how for example, templates feel like they generate different versions of the same function at compile time. But I have a hard time understanding how this works (compared to say, C macros) or how overloading operators feel like making just another function call. On top of that, there's C++11 and 14 and 17, and all that, I'm not really sure if the preferred way to do something has changed at all if I read something with "Modern C++11" in the title.

I do like having the STL though. I think it's useful to have basic stuff instead of having to use glib for everytime I want some basic data structure (or implement it myself).

I guess this one's one me. I'm not really familiar with everything in rust, but it also gives me the same cognitive dissonance as C++ (albeit less than C++) in terms of how these abstractions translate to zero cost. At least they seem to have a pretty good book on learning it (although the second edition feels like it's been under construction since forever).

I've used dozens of programming languages and only two have unironically made me want to kill myself:
1. PHP
2. MATLAB
It's thoroughly disgusting. If you really enjoy fucking around with matrices that much, go learn Julia.

Why? I admit I know only 2 languages
But is it really that bad?
Did I waste 3 months on this?

It was designed in the 80s by people with a fetish for global mutable state who didn't really understand how function calls should work.
It forces you to memorize bizarre quirks, watch out for stupid gotchas and write ugly code.
If you knew anything other than MATLAB and C, you would already know how bad it is.

Tell us what you're using it for so we can recommend some alternatives that don't suck.

My uni uses it , /r/aerospace suggested it
I really made a mistake then.
I'm a fresher, I use it to visualise physics problems with graphs and reading data for plots. I did not like gnuplot, plotting seems to be much easier in matlab
I did like half of programming : principles and pratices with c++ in 11th grade but I'll probably have to re-read a couple of chapters now.
What's the best way forward?
Anything which will look good on resume for aerospace engineering

Well, you're kind of fucked then. MATLAB sucks but it is industry-standard and you will have to work with it.
Consider learning Python, though, if only so you can acquire some good programming habits.

w-what about go guys

Thanks!
Will try Python

go fuck yourself

What is that supposed to be?
A generic?

yes

>C++
almost ok now
>Rust
almost ok now
>D
they had their chance and didn't use it
>Nim
has one good feature but is fucked otherwise, same as lisp

I bet you have that "trusted a pike" pic too.

but cmon whats so bad about go

its comfy
fast

It's fucking algol 68

Go may eventually get more features as the language develops, but rust & co will always be fucking retarded

cool story, I'm sure blub has a bright future.

blub is literally the most common programming language out there.

SO yeah.

It will get more features, and they'll be fundamentally broken because Go is a terrible foundation for a programming language. It's Java/C++ all over again. Fuck Go and all the brainlets who worship it.

Too bad go has amassed a retarded following full of people like yourself who actively resist any sort of language improvement because you want pure blub.

It doesn't need more features.
Its good the way it is. The only thing I would add is currying.
People hate on it because its good and simple.