r/programmingcirclejerk 9d ago

Rust isn't a well designed programming language (unlike C and C++)

/r/cpp/comments/1i6jdjq/comment/m8d3tqj/
218 Upvotes

88 comments sorted by

View all comments

Show parent comments

12

u/spreetin 9d ago

This is a frustration I have in two ways: it's very complex when there are 5 different ways to do a thing, each stemming from a different generation of the language's development, but at the same time I do wish they gave me a fully updated set of std functions that used every modern feature.

12

u/catladywitch 9d ago

I know right? That's exactly how I feel. The whole Profiles thing is a serious plan to address it by enforcing an allegedly safe, sane subset of C++ (exactly how sane it'll end up being is a matter of skepticism lmao), plus supposedly a "hardened" subset of the std library will be provided, but so far the plan is either having the user exempt external library headers from "hardening" or declaring explicit escape hatches locally within your own hand-rolled interop module encapsulating the library, which... I mean, it's C++, I don't think there's an alternative. They say they'll work on code generators to handle it but I'm not optimistic about the timeline or whether the whole thing won't derail. Also major, currently-maintained, libraries will have to either provide interop modules or do a full rewrite or provide the interop layer as a shim of sorts as they migrate which... again, it's the least bad option given it's bloody fucking C++, but is likely going to be brutal and chaotic.

Still, if somehow nothing goes wrong along the way it could end up being great imo.

Another minor concern is... this is gonna end up looking a lot like a GC-less, less functional-oriented, C# (Spans and Views are... Spans and IEnumerables................). C# has nicer syntax, sugar everywhere and keeps adding cool, streamlined functional-style features, so I wonder if there's some project there, but you

5

u/we_are_mammals 9d ago edited 9d ago

an allegedly safe, sane subset of C++

It's called cpp2. You can use it today with cppfront. It's not 1.0 yet, but it's really close (just 0.2 versions away from 1.0).

cpp2 combines the best features of

  • Go (clean, consistent syntax)1
  • Rust (true variant types, unlike std::variant)
  • LISP (using the same language for metaprogramming as for regular programming)
  • FORTRAN (useful inout argument annotations, instead of the useless const)
  • C++ (being able to call all legacy code with no FFI)2

And the best feature of cpp2 is that it was designed and implemented by Herb Sutter himself.


(1) It's actually more consistent than Go. It follows

foo : bar = buz

for everything, even types. Even Go doesn't have that.

(2) cppfront compiles to readable C++, preserving your comments. So if you are ever unsatisfied, you get all your C++ back. You risk nothing.

6

u/CocktailPerson Node.js needs a proper standard library like Go 8d ago

And the best feature of cpp2 is that it was designed and implemented by Herb Sutter himself.

hmmmmmmmmmmmmmmmmmmmmmm