News for hackers. Stuff that matters.
Re:We need to seriously think about what to do with C++ modules by fooker on Monday September 01, 2025 @09:22PM (#45098156)
> You see that Rust function destroyed the T. It's gone, no more T. But your C++ function makes a new T, then destroys the old one, so there's still a T, it's not gone after all.

Perhaps your idea of C++ semantics is a bit off?

Re:We need to seriously think about what to do with C++ modules by tialaramex on Tuesday September 02, 2025 @02:30AM (#45099749)
After more consideration I think probably your functions don't do anything at all?

Is that the joke here? That despite everything you didn't understand why core::mem::drop has that definition and so reading the empty body you assumed that you can just not do anything and that'll work in C++ ?

Re:We need to seriously think about what to do with C++ modules by fooker on Tuesday September 02, 2025 @09:09AM (#45102641)
Are you trolling? Or do you genuinely not understand why it might work in C++?

https://godbolt.org/z/58TqTTM37

Re:We need to seriously think about what to do with C++ modules by tialaramex on Tuesday September 02, 2025 @10:07AM (#45103316)
No, I'm not trolling, I'll give you the benefit of the doubt, try this C++:

https://godbolt.org/z/zM3oxjrfn

and contrast this Rust:

https://rust.godbolt.org/z/1rMYcqY65

In your unique_ptr<T> example what you'd hidden (from me? Or perhaps from yourself) was that we're not destroying the unique_ptr, we're just destroying the Foo, and since the unique_ptr is null the destructor for that will be silent when the scope ends.