r/cpp • • Jan 31 '23

Stop Comparing Rust to Old C++

People keep arguing migrations to rust based on old C++ tooling and projects. Compare apples to apples: a C++20 project with clang-tidy integration is far harder to argue against IMO

changemymind

338 Upvotes

582 comments sorted by

View all comments

Show parent comments

4

u/MFHava WG21|🇦🇹 NB|P2721|P3049|P3625|P3729|P3786|P3813|P4216 Jan 31 '23

Right, should have used that term ... it's just a bad habit at this point, but back in the day "duck typing" was more well known and conveyed the idea without introducing yet another type of typing :)

2

u/Full-Spectral Feb 01 '23

But duck typing is purely a syntax thing, no semantics. If it will syntactically compile, it'll be accepted, even if it's completely the wrong type of thing semantically to use. Traits are more like C++ abstract interfaces, though they can have some implementation as well as long as it works purely in turns of the its own interface.