Hacker News new | past | comments | ask | show | jobs | submit login

Rust will only be a real competitor once it’s generics can hold a candle to C++ templates.



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.


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.

https://youtu.be/gOdcNko2xc8

https://youtu.be/tiAVWcjIF6o


So, in response to 'templates are generics + things you shouldn't do', your counterargument is a non sequitur about tuples, a video titled 'Code You Should Learn From & Never Write', and a video about introductory templates which doesn't actually contain any counterexamples?


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).


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.


SFINAE




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: