Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.programming.threads > #3954 > unrolled thread

C++ or Rust ?

Started byIntelli2 <intelli2@mama.com>
First post2017-12-04 15:40 -0500
Last post2017-12-04 15:40 -0500
Articles 1 — 1 participant

Back to article view | Back to comp.programming.threads


Contents

  C++ or Rust ? Intelli2 <intelli2@mama.com> - 2017-12-04 15:40 -0500

#3954 — C++ or Rust ?

FromIntelli2 <intelli2@mama.com>
Date2017-12-04 15:40 -0500
SubjectC++ or Rust ?
Message-ID<p04br4$rfr$3@dont-email.me>
Hello,

Read this:

===

I have used Rust quite a bit and even managed to create a video course 
on it. While I enjoy Rust, it cannot really compete with C++ because:
C++ is object-oriented, Rust isn't like C++.

My observations about Rust:

Simple OOP is easy, but you'll often find that straight procedural is 
simpler once you stop thinking of everything as an object.
Abstract classes are not really possible, very clunky work-arounds. Say 
you have an Abstract class that implements 95% of the functionality, but 
you want your user to implement the last 5% and then supply the class to 
your library. This is easy to do in Rust, but requires the user to 
implement essentially a wrapper around the Abstract struct. It exposes a 
lot of ugly API to end-users. There are workarounds (using closures, 
etc) but the resulting API is ugly either way.

Polymorphism and generics are non-trivial and requires hoop-jumping. The 
mental hurdle for me is that traits != types. I often find myself 
wanting to declare a variable as a trait: e.v. Vec<Amphibian>, where 
Amphibian is a trait. I want a vector of amphibians and don't care what 
the actual implementation is. You can't do this however. Instead, you 
often have to wrap everything in an enum and then dispatch methods to 
the underlying type.

My observation about C++:

The Intel compiler, terrible as it is, give the 'absolute most' 
performance in terms of SSE and auto-parallelism. I do find some of IPS 
tools gimmicky but the compiler gives the numeric performance I need.
A good IDE (CLion and ReSharper C++) is an absolute must for me.

Intel Parallel Studio tools such as VTune are epic and I don't see 
anything in the Rust space.

C++ ecosystem has all the libs I need, even if I don't enjoy those APIs 
as much. For example, if I want motion graphics, I grab 
Direct2D/DirectWrite and FFMPEG and I'm good to go.

Modern C++ is a lot of fun to learn and use, there's plenty of evolution 
of the language and a neat community.


===




Thank you,
Amine Moulay Ramdane.

[toc] | [standalone]


Back to top | Article view | comp.programming.threads


csiph-web