News for hackers. Stuff that matters.
Re:How I went about learning Rust by nicoburns on Friday July 15, 2022 @06:48AM (#32106790)
It definitely works differently to C++/Java/Python, but IMO this is one place where Rust is a huge improvement. You are effectively always generic over an interface (trait in Rust) rather than a base class, and this is much more flexible as a given strict can implement as many interfaces as it likes rather than being stuck in one class hierarchy (or having to deal with the pain of multiple inheritance)
Re:How I went about learning Rust by pjmlp on Friday July 15, 2022 @06:59AM (#32106853)
It is no different than using interfaces, protocols, pure virtual base classes....
Re:How I went about learning Rust by dllthomas on Friday July 15, 2022 @09:11AM (#32107793)
It's similar, but there are some differences. Notably, my package can implement my trait for your type, while my package (usually? always?) cannot make your type inherit from my virtual base class.
Re:How I went about learning Rust by pjmlp on Friday July 15, 2022 @09:36AM (#32108032)
Depends on the flexibitly of the language, there isn't a golden way to do that across all variations of OOP.
Re:How I went about learning Rust by eklavya on Friday July 15, 2022 @01:13PM (#32110442)
Wrapper classes should be equally good once Valhalla (jdk) lands, without introducing another pointer indirection.
Re:How I went about learning Rust by adamc on Friday July 15, 2022 @02:46PM (#32111488)
Interesting but Java gets more and more complex in a way that does not make me want to write things in Java.