4 ms·
Question: isn’t a rich type system as described here similar to OOP?
by sanp 4y ago
Question: isn’t a rich type system as described here similar to OOP?
- masklinn 4y agoThe essay uses a class-oriented type system (they're clearly a .net developer), but the same ideas very much exist in non-OO type systems. And the richest and most expressive type systems are arguably specifically non-OO. Nor are OO languages necessarily statically typed (Smalltalk, Self, Python, Ruby, Javascript, ...)
- Smaug123 4y agoNo no no, entirely not. OOP need not be statically typed at all; see Smalltalk.
- remram 4y agoOr Python, or JavaScript. The reverse is true, you can have static type-checking without OOP, like C, Rust, Haskell.
- tsimionescu 4y agoI feel compelled to note that C only has the lightest possible amount of type checking, if even that. For example, the following program compiles: #include <stdio.h> void foo(double* c) { printf("%g", *c); } void bar() { printf("bar"); } int main() { int x = 9; int* y = &x; foo(x); //warning foo(y); //warning bar(1.0); //not even a warning }
- miskin 4y agoI think it is related to how you organize your data structures and business logic - you may have rich typed model that models specific domain, but OOP would typically call to include all the business logic that modifies attributes of class to be part of that class - eg, you do not externally set specific values to class instance, but instead execute some action on the class instance that may change these attributes. If you use type system just to model data structures and have external business logic to use/change it, it would be called anemic model.