Re:Switching from C++ to Rust
by alphanullmeric on Monday March 13, 2023 @11:01PM
(#35146837)
Rust will only be a real competitor once it’s generics can hold a candle to C++ templates.
[ Parent
| on HN ]
Re:Switching from C++ to Rust
by umanwizard on Tuesday March 14, 2023 @02:50AM
(#35148163)
I disagree, Rust is already being used for tons of real-world projects. It’s quite rare that you miss the flexibility of templates (and can’t accomplish a similar thing using macros or generated code).
Re:Switching from C++ to Rust
by pie_flavor on Tuesday March 14, 2023 @04:23AM
(#35148662)
The article specifically mentions not holding said candle as a positive. I would too. They're confusing at best and undebuggable at worst, and virtually everything you can do with them that you can't do with generics is something it'd be better for everyone if you didn't do.
Re:Switching from C++ to Rust
by alphanullmeric on Tuesday March 14, 2023 @11:17AM
(#35152871)
Oh here we go again. “Everything rust can’t do is an antipattern” is not a valid argument. Tuples for instance are a library feature in C++ but have to be a language feature in rust. Plenty of other useful things that C++ can do and rust cannot.
Re:Switching from C++ to Rust
by pie_flavor on Wednesday March 15, 2023 @12:40AM
(#35163960)
So, in response to 'templates are generics + things you shouldn't do', your counterargument is a video titled 'Code You Should Learn From & Never Write' and a video about introductory templates which doesn't actually contain any counterexamples?
You forgot to add /s.
Thanks but no, replacing a bunch of code as strings and then relying on some code _not_ compiling should be left in 20th century for good.
I have a feeling you're talking about C macros, not C++ templates.