5 ms·
On the topic of a “forced” C++ to be close to rust. I guess technically if you forced all allocations to be in unique_ptr<> and then used std::move every time
by 3a2d29 4y ago
On the topic of a “forced” C++ to be close to rust.
I guess technically if you forced all allocations to be in unique_ptr<> and then used std::move every time you passed it as a parameter, you would kind have the first part of rust (ownership rules) down.
But the borrow checker? Not sure how that’s possible. It might be (and in fairness, you could require all references to be const)
But I am not sure if there’s a way to do the usual 1 and only 1 borrowed mutable value. (Unless someone can think of a way?)
- bluGill 4y agoThe C++ commitee is interested. Carbon is a Google attempt at at c++ with safety.
- 3a2d29 4y agoI don’t think Carbon will have a borrow checker. I am under the impression it’s just checking array bounds and adding nicer syntax
- WalterBright 4y agoD already has a borrow checker in prototype form.
- bluGill 4y agoCarbon is experimental, don't make any predictions. Herb Sutter has his own that I forget the name of with interesting things that when mature are making it to C++
- senkora 4y agoHe calls it cpp2 or Syntax 2: https://github.com/hsutter/cppfront https://github.com/hsutter/cppfront