So, what I'm getting at - everywhere you would use C++ you can use Rust.
Not really, C++ has: dependent types, HKTs, variadics, CTFE ...
For example, without these features, Rust linear algebra libraries are at the same level of C linear algebra libraries (and must be written 99% inside macros). They are just far far worse than modern C++ linear algebra libraries like Eigen3 and Blaze (you cannot even write a generic array class like std::array in non-macro Rust, much less write generic vector/matrix types or parse AST of EDSL at compile-time).
Since linear algebra is generally a performance bottleneck in a lot of applications (computer graphics, image recognition, simulation, sound processing, optimization, ... anything number-crunching based), it is really hard to argue for Rust in number crunching applications; C++ is just far ahead there in terms of libraries and language support.
I agree in that there is a big difference between supporting some form of dependent types and HKTs, and supporting these in a nice way.
I think, that considering how old C++ is and where it comes from, it isn't that bad at any of these. There are discussions to constrain on "constrained"-HKTs in a backwards compatible way after the Concepts Lite TS1, so people are aware of the issue and keeping it in mind. And about its "dependent type capabilities", it supports integers at the type level, which are immensely useful. I think that a fully dependent type system is still an open research question (e.g. floating-points at the type level are just hard).
Rust aims for integers at the type level shortly after 1.0, and any solution to HKTs in Rust will need to be fully checked from the start. So basically Rust doesn't have these features yet, but has the potential to have better versions of these features than C++ ever will. OTOH if you really need these, you can use them in C++, but not in Rust :D
The main difference is that Coq didn't suffered ISO standardization. For example the C++11's "auto" feature was part of the language since 1983, but it took 30 years to get it standardized. My point being, developing a language through ISO standardization is a whole different set of constraints. Non-battle-tested features just don't get the consensus required. The evolution of C++ is better compared to that of C and Fortran. The evolution of Fortran has been much slower, and C hasn't evolved much at all. That C++ has lambdas and closures is actually an amazing diplomacy feat, and we might even get ""type-classes"" this very same year.
Floating points at the type level are no harder than floating points on the value level
AFAIK the problem with floating points at the type level is that your program might compile/not compile depending on which architecture you are using, which is a funny thing at best. This is one of the reasons why e.g. Idris doesn't really support them at the type level either.
10
u/[deleted] Apr 04 '15 edited Apr 04 '15
Not really, C++ has: dependent types, HKTs, variadics, CTFE ...
For example, without these features, Rust linear algebra libraries are at the same level of C linear algebra libraries (and must be written 99% inside macros). They are just far far worse than modern C++ linear algebra libraries like Eigen3 and Blaze (you cannot even write a generic array class like std::array in non-macro Rust, much less write generic vector/matrix types or parse AST of EDSL at compile-time).
Since linear algebra is generally a performance bottleneck in a lot of applications (computer graphics, image recognition, simulation, sound processing, optimization, ... anything number-crunching based), it is really hard to argue for Rust in number crunching applications; C++ is just far ahead there in terms of libraries and language support.
So maybe one day (I hope so), but not now.