Recent improvements in GCC diagnostics
Recent improvements in GCC diagnostics
Posted Oct 15, 2023 11:03 UTC (Sun) by dvdeug (guest, #10998)In reply to: Recent improvements in GCC diagnostics by khim
Parent article: Recent improvements in GCC diagnostics
That's like saying 2+2 in Python is equivalent to BigInteger(2).plus(BigInteger(2)) in Java. I mean, in some sense it is (actually, something more powerful), but 99% of the time you don't need more than 2+2 in Java. Rust generics are designed to cover most of the cases that C++ templates are; if you're talking about those cases, templates and generics are the right comparison.
Posted Oct 15, 2023 14:08 UTC (Sun)
by khim (subscriber, #9252)
[Link]
The problem is that “crazy and impenetrable error messages” that C++ is so famous for are not from these cases. And they can be covered by concepts just fine. It's heavy and convoluted TMP that is intrinsically linked with these. Where you can use Very good example. Yes, 99% of time you don't care about limitations of Java integers. But when you start, specifically, talking about how convoluted and awkward syntax of Java is for user-defined types then the fact that you can use overloaded operators to mix integers with bignums and user-defined types is Python, but not in Java that difference becomes important.
> Rust generics are designed to cover most of the cases that C++ templates are; if you're talking about those cases, templates and generics are the right comparison.
Recent improvements in GCC diagnostics
std::is_same_v
, std::enable_if_t
, if constexpr
and other such things. And Rust generics are completely unsuitable for these usecases, only macros can do that something similar.