4 ms·
Rust actually can do things C++ can't do. People who use Turing equivalence to equate language capability are just uneducated imo. There's another "truth" of P
by whateveracct 6y ago
Rust actually can do things C++ can't do. People who use Turing equivalence to equate language capability are just uneducated imo.
There's another "truth" of PLs: Curry-Howard. So a language with a richer type system can express more propositions than a lesser one. Just because two languages are Turing equivalent doesn't mean they are Curry-Howard-equivalent.
So the things some languages can do that others can't happen at compile time.
And tbh, you'd probably be better served by a language that isn't Turing complete but allows you to express rich types than a Turing complete language with a bad type system. Very little of people's code needs Turing completeness.
- naikrovek 6y ago> Rust actually can do things C++ can't do. People who use Turing equivalence to equate language capability are just uneducated imo. This is a very myopic view, and misses the point entirely. The entire notion of a "Turing machine" is that any Turing-complete machine can compute any result that another Turing-complete machine can compute. No mention is made of how the results are computed or how the programmer approaches the problem on each machine. Any Turing Complete language can be used to do the same work as any other Turing complete language or mechanism. The expressiveness of any particular language does not factor into the equation at all, and does not matter at all when speaking of what is computable and what is not. You are talking about language features, which is an entirely different topic. All Turing-complete languages are equivalent in terms of their abilities; that is to say that they can all compute the entire set of computable results.
- whateveracct 6y agoRight I'm saying there are other theory-grounded ways of discussing language capability beyond Turing completeness.
- postalrat 6y agoCan any code written in rust be transpiled to c++ without losing something?
- codewiz 6y agoIf "something" includes safety and maintainability, then no.
- postalrat 6y agoMaintainability doesn't matter in this case. I would assume all the safety features of rust could be implemented in the transpiled code.
- doteka 6y agoIf maintainability doesn’t matter, what are we even talking about though? If a solution is maintainable in Rust and an utter nightmare in C++, the answer to the question is “nope” for all practical purposes.
- smitop 6y agoNo. There is no version of the env! or include_str! macro! in C++ (they are implemented in the compiler for Rust). These macros can be used to the get the values of environment variables or the contents of arbitrary files at compile time. You could of course implement them within a build system, but there isn't a way to replicate these macros with just pure C++ being passed to a compiler, even with pre-processor macros.
- slavik81 6y agoFile embedding seems to have been a low priority for the standard, perhaps because there's always been workarounds, but it has gotten some attention recently with the std::embed proposal: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2018/p1040r0.html http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2018/p104...
- benrbray 6y ago> Very little of people's code needs Turing completeness The Wikipedia page on Total Functional Programming [1] has a nice (even if contrived) example of this with Quicksort. I feel like my undergrad complexity class did me a disservice by emphasizing Turing Completeness so much without discussing any other aspects of abstract computation, like lambda calculus, type systems, etc.. [1]: https://en.wikipedia.org/wiki/Total_functional_programming https://en.wikipedia.org/wiki/Total_functional_programming