▲ | Panzerschrek 2 days ago | |||||||
Porting Rust enums and pattern matching isn't necessary (C++ already has std::variant). Lifetime parameters aren't necessary, lifetime contracts may be implemented in a different and much easier way. This may be expressed in form of a function attribute, which may be calculated via constexpr code. Special operators for borrowing just add more complexity. C++ already achieves same behavior by normal references (which may be mutable and non-mutable). Introducing immutability by default isn't strictly necessary for achieving safety. C++ developers are already mostly fine writing "const" almost everywhere. | ||||||||
▲ | purplesyringa 2 days ago | parent | next [-] | |||||||
> Lifetime parameters aren't necessary, lifetime contracts may be implemented in a different and much easier way. This may be expressed in form of a function attribute, which may be calculated via constexpr code. Wouldn't that just be slightly different syntax for the same idea? If you want to represent relationships like "the pointer in the field Struct::field_name within this argument is linked with the lifetime of the returned pointer" and you want them to be reusable across functions and contexts, isn't the most obvious way to write that a variant of
| ||||||||
| ||||||||
▲ | seanbax 2 days ago | parent | prev [-] | |||||||
Lifetime parameters are necessary for borrow checking. And you need a special operator for initiating a borrow. You need immutability by default, because mutability everywhere violates exclusivity. | ||||||||
|