Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

C++ or Rust ?

40 views
Skip to first unread message

Intelli2

unread,
Dec 4, 2017, 3:38:24 PM12/4/17
to
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 observatoin 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.

Öö Tiib

unread,
Dec 4, 2017, 7:05:23 PM12/4/17
to
On Monday, 4 December 2017 22:38:24 UTC+2, Intelli2 wrote:
> Hello,
>
> Read this:

Why you copy paste from reddit discussion of 3 year ago?
https://www.reddit.com/r/rust/comments/27sbgr/oop_in_rust/

Better go and spam your comp.programming we can read reddit just fine.
0 new messages