3 ms·
> Not at all, OOP type theory is OOP type theory. Tell that to Google. OOP type theory returns mostly Category type theory as results. What sources do you hav
by Ygg2 2y ago
> Not at all, OOP type theory is OOP type theory.
Tell that to Google. OOP type theory returns mostly Category type theory as results.
What sources do you have on OOP type theory? Our OOP classes were heavy on practical part and less so on theory.
> Rust has enough features from OOP type systems
It's missing inheritance. Without inheritance applying OOP design patterns just fails miserably.
So on one side you have stuff like Java, C++, JS, Ruby, Python and on the other Rust.
> Static and dynamic polymorphism, methods, data encapsulation, type dispatch, all there.
By that definition, Python isn't object oriented (no encapsulation), and C is.
I think it's much more natural to reason about types on what they can do versus some nebulous definition.
I mean any language worth its salt will have encapsulation. It's how you preserve your invariants.
Method is mostly just syntax sugar.
And static/dynamic polymorphism is just a fancy way to say we have function overloading and/or templates and/or vtables (even if using pointer casts).
- pjmlp 2y agoSearch better, look into SIGPLAN and IEEE papers. Class inheritance is not a requirement for OOP languages. I listed the OOP traits supported by Rust as a language. Naturally you have to nitpick it to try to make a point out of nothing. All high level languages are fancy ways to write machine code.
- Ygg2 2y ago> I listed the OOP traits supported by Rust as a language. So is the list missing items? > Naturally you have to nitpick it to try to make a point out of nothing. What did I nitpick? Does Python have encapsulation beyond gentlemen's agreement? Can't C have any of the listed behaviors?
- pjmlp 2y agoPython OOP != Rust OOP, but you naturally already knew that. However, in case you need some help, in regards to Python Classe inheritance, function and data members, dynamic dispatch, polymorphism, meta-classes. And even if C doesn't offer direct language support for a OOP type system, that isn't stopping anyone, like the Linux kernel and GNOME/Gtk+. Or publishing books on the matter, http://www.freetechbooks.com/object-oriented-programming-with-ansi-c-t551.html http://www.freetechbooks.com/object-oriented-programming-wit...
- Ygg2 2y ago> Python OOP != Rust OOP, but you naturally already knew that. No. Bold of you to assume that. I wasn't aware that one OOP isn't another OOP. I see, so OOP is a fuzzyish definition that you check more checkboxes to satisfy. If Rust is OOP, and Python is OOP and C is OOP, then the that circles back to my initial claims. A category that is so wide it's effectively useless. Compare this to sync and async. A precise definition, much greater informational content. You can prove something is pure or not[1]. Compare this to OOP, imprecise, less informational context, impossible to (dis)prove something is OOP or not. [1]https://www.youtube.com/watch?v=43XaZEn2aLc https://www.youtube.com/watch?v=43XaZEn2aLc