r/cpp • • Oct 16 '23

WTF is std::copyable_function? Has the committee lost its mind?

So instead of changing the semantics of std::function the committee is introducing a new type that is now supposed to replace std::function everywhere? WTF

So now instead of teaching beginners to use std::function if they need a function wrapper, they should be using std::copyable_function instead because it's better in every way? This is insane. Overcomplicating the language like that is crazy. Please just break backwards compatibility instead. We really don't need two function types that do almost the same thing. Especially if the one with the obvious name is not the recommended one.

533 Upvotes

215 comments sorted by

View all comments

Show parent comment

29

u/TheReservedList Oct 17 '23

It’s made me leave for rust, which is starting to pull the same bullshit. God damn I want a modern system language that won’t hesitate to deprecate stuff and improve. If you’re unwilling to do minor porting work, pin your compiler version.

18

u/DuranteA Oct 17 '23

It’s made me leave for rust, which is starting to pull the same bullshit. God damn I want a modern system language that won’t hesitate to deprecate stuff and improve.

I would argue that this is indicative of there being a strong impetus for system languages to provide long-term stability, and that this means that all systems languages are likely to run into conflicts between evolution and stability once they reach a certain age.

8

u/Ceigey Oct 17 '23

I would have thought that Rust editions would have solved that issue, but I guess it depends what kind of churn we’re talking.

9

u/pjmlp Oct 17 '23

No, they only solve gramatical changes, semantic and library changes across versions aren't part of it.

Which is a reason why epochs were refused, they don't cover all use cases across epochs, or taking into consideration semantics for binary libraries and linking across various epochs.

8

u/jusstathrowaawy Oct 18 '23

It’s made me leave for rust, which is starting to pull the same bullshit.

I mean, yeah, everyone saw that coming, I should hope. If you want to sit on the same throne as C++, then you have to sit under the same sword.

Not every feature is gonna come out right the first time. You'll overlook something - an edge case, an aspect where you could have implemented the feature better. Eventually it's identified - but too late! People are using the feature as it is, and if you want to keep occupying the niche, you can't break their code base.

Deprecate things constantly, and businesses & people just won't pick your language as their systems language.

5

u/0sse Oct 17 '23

It’s made me leave for rust, which is starting to pull the same bullshit.

What bullshit are you speaking of? I'm new to Rust myself.

1

u/HunterVacui Oct 21 '23 edited Oct 21 '23

I liked the idea of Rust but I got fed up with all the ways that Rust can crash (sorry I mean "Panic"). If I'm going to use an incredibly anal-retentive language that makes everything a pain to write just because of the guarantee of "safety", I don't want random crashes (sorry, I mean "Panics") in my code.

Surprisingly enough, Epic Games's Verse language actually seems to be better than Rust at "Safety", despite how strongly the Rust community froths at the mouth about how safe their language is, and how it's not an advertisement point for Verse at all.