News for hackers. Stuff that matters.
Re:Rust Weird Expressions by ncmncm on Saturday May 15, 2021 @07:54PM (#27170020)
ByteJockey refers to value types, and value semantics.

Besides value types' benefits to code comprehension, they often give the optimizer enormously more latitude to operate because it knows there are no stray pointers to the object.

Over-use of std::shared_ptr is called Java Disease. It has been seen to be curable. A value object containing just a std::unique_ptr<Impl> member (often called "Pimpl", pointer-to-implementation) gets most benefits of value semantics, in cases where Impl is bigger than you would want to pass around directly, and stylistically is overwhelmingly better than passing and returning std::unique_ptr.

There are no comments on this comment yet.