by sanp · 4y ago · 0 comments
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, ...)
The reverse is true, you can have static type-checking without OOP, like C, Rust, Haskell.
#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
}