are there any typeless typesafe languages? By typesafe I mean types are checked at compile time. By typeless I mean types are not declared.
I know this is easier than it sounds, maybe even impossible but for example if I had code like this
foo = {
bar: 123;
}
In some imaginary language I can possibly know that bar
is an int
and foo is a struct/object/class with 1 int field.
Similarly if I do this
SomeFunc(v) {
printInt(v.bar);
}
And elsewhere I do this
SomeFunc(foo);
All of that seems type checkable at compile time. With enough context it might even be type checkable across compilation units.
Are there any languages that have attempted this? Basically make it possible to rarely declare types and yet still be typesafe at compile time ?