Re:Things I Was Wrong About: Types
by viraptor on Sunday September 27, 2020 @08:35AM
(#24606179)
You're showing an example of a function signature in a specific language, not an example of typing though. These are related but not exactly the same.
For example here is a Ruby version, very dynamic:
def request(method, url, **options)
end
request("get", "http...", foo: "bar")
And here is a completely statically typed Crystal version:
def request(method, url, **options)
end
request("get", "http...", foo: "bar")
The argument types are inferred automatically from the usage and mismatched usage will be caught at compile time. And in the second case the ide can still tell you the types in the signature if you want to know them.
In the third example, here's completely dynamic python:
For example here is a Ruby version, very dynamic:
And here is a completely statically typed Crystal version: The argument types are inferred automatically from the usage and mismatched usage will be caught at compile time. And in the second case the ide can still tell you the types in the signature if you want to know them.In the third example, here's completely dynamic python:
No type checking happens here in the language itself.So what I'm getting at is - if you don't like languages with verbose explicit type signatures, it doesn't mean you don't like static types.