Re:Rust Is Hard, Or: The Misery of Mainstream Programming
by jules on Friday June 03, 2022 @08:34AM
(#31607371)
Traits are the one part of Rust that should definitely not be given up. It is way better than the traditional OO model.
Re:Rust Is Hard, Or: The Misery of Mainstream Programming
by pjmlp on Friday June 03, 2022 @04:19AM
(#31605642)
Actually something like traits (as concept) is what powers COM, WinRT, the basis of Objective-C protocols that influenced interfaces in more common OOP languages.
Also the basis for one programming language that used to be widespread in the enterprise for quick and dirty solutions, VB and its ecosystem of OCX libraries.
It is more widespread that people think, because when many argue about OOP, they miss the full spectrum of how OOP is approached.
Re:Rust Is Hard, Or: The Misery of Mainstream Programming
by NoGravitas on Friday June 03, 2022 @12:27PM
(#31610491)
Traits seem, to me, a lot like generic functions and methods in CLOS (Common Lisp). It's just that CLOS doesn't bundle a group of generic functions into a trait, they're a la carte.
Re:Rust Is Hard, Or: The Misery of Mainstream Programming
by pjmlp on Friday June 03, 2022 @12:48PM
(#31610710)
Yes they do, they are called protocols.
Re:Rust Is Hard, Or: The Misery of Mainstream Programming
by lelanthran on Friday June 03, 2022 @05:55AM
(#31606287)
> Actually something like traits (as concept) is what powers COM, WinRT, the basis of Objective-C protocols that influenced interfaces in more common OOP languages.
So? Giving up Rust-Traits doesn't mean that I will give up on interfaces as a whole.
I don't like the way C++ does interfaces, for example, but that doesn't mean that my ideal language won't have interfaces.
Traits, maybe? Switch to an OO model more closely aligned to what the majority of developers understand. Dump all of the line-noise-type syntax.
My Own Toy Language (ComingRealSoonNow)^tm that I started designing had exactly one goal - prevent the majority of memory errors, not prevent ALL memory errors. All I wanted was to indicate when/where an object will be destroyed/mutated. That's enough for me.